Markus Elfring [Wed, 12 Oct 2016 13:30:44 +0000 (10:30 -0300)]
[media] DaVinci-VPIF-Display: Use kcalloc() in vpif_probe()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Wed, 12 Oct 2016 13:15:34 +0000 (10:15 -0300)]
[media] DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Wed, 12 Oct 2016 09:22:23 +0000 (06:22 -0300)]
[media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()
Move assignments for two local variables into an else branch so that
their setting will only be performed after corresponding data processing
succeeded by this function.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Wed, 12 Oct 2016 08:44:05 +0000 (05:44 -0300)]
[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_open()
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Wed, 12 Oct 2016 08:24:57 +0000 (05:24 -0300)]
[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Wed, 12 Oct 2016 08:20:02 +0000 (05:20 -0300)]
[media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Tue, 11 Oct 2016 07:40:41 +0000 (04:40 -0300)]
[media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Sun, 9 Oct 2016 19:12:13 +0000 (16:12 -0300)]
[media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Fri, 7 Oct 2016 20:07:27 +0000 (17:07 -0300)]
[media] cx88-dsp: Use kmalloc_array() in read_rds_samples()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Fri, 7 Oct 2016 19:07:43 +0000 (16:07 -0300)]
[media] dvb-tc90522: Use kmalloc_array() in tc90522_master_xfer()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] v4l2-flash-led-class: remove a now unused var
commit 079933dbcb02 ("[media] v4l: flash led class: Fix of_node release
in probe() error path") removed the need of an ancillary var at
the release function, as reported by smatch:
drivers/media/v4l2-core/v4l2-flash-led-class.c: In function 'v4l2_flash_release':
drivers/media/v4l2-core/v4l2-flash-led-class.c:678:23: warning: variable 'led_cdev' set but not used [-Wunused-but-set-variable]
struct led_classdev *led_cdev;
^~~~~~~~
Get rid of it.
Fixes: commit 079933dbcb02 ("[media] v4l: flash led class: Fix of_node release in probe() error path") Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Enrico Mioso [Tue, 4 Oct 2016 11:13:27 +0000 (08:13 -0300)]
[media] Add Cinergy S2 rev.4 support
This patch derives from previous one(s) by CrazyCat. I used the commit adding rev.3 to mainline Linux kernel as an example, so credits go to its author(s).
The hardware seems to scan and tune OK.
[media] rc: core: add managed versions of rc_allocate_device and rc_register_device
Introduce managed versions of both functions.
They allows to simplify the error path in the probe function of
rc drivers, and usually also to simplify the remove function.
New element managed_alloc in struct rc_dev is needed to correctly
handle mixed use, e.g. managed version of rc_register_device and
normal version of rc_allocate_device.
In addition devm_rc_allocate_device sets rc->dev.parent as having a
reference to the parent device might be useful for future extensions.
Robert Jarzmik [Fri, 23 Sep 2016 18:41:39 +0000 (15:41 -0300)]
[media] media: platform: pxa_camera: add missing sensor power on
During sensors binding, there is a window where the sensor is switched
off, while there is a call it to set a new format, which can end up in
an access to the sensor, especially an I2C based sensor.
Remove this window by activating the sensor.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] cx88: fix error return code in cx8802_dvb_probe()
Fix to return error code -ENODEV from the error handling case
instead of 0(err maybe overwrited to 0 in the for loop), as
done elsewhere in this function.
[mchehab@s-opensource.com: remove a now uneeded set for err = -ENODEV]
Moving the pxa_camera driver from soc_camera lots the implied
VIDEO_V4L2 Kconfig dependency, and building the driver without
V4L2 results in a kernel that cannot link:
drivers/media/platform/pxa_camera.o: In function `pxa_camera_remove':
pxa_camera.c:(.text.pxa_camera_remove+0x10): undefined reference to `v4l2_clk_unregister'
pxa_camera.c:(.text.pxa_camera_remove+0x18): undefined reference to `v4l2_device_unregister'
drivers/media/platform/pxa_camera.o: In function `pxa_camera_probe':
pxa_camera.c:(.text.pxa_camera_probe+0x458): undefined reference to `v4l2_of_parse_endpoint'
drivers/media/v4l2-core/videobuf2-core.o: In function `__enqueue_in_driver':
drivers/media/v4l2-core/videobuf2-core.o: In function `vb2_core_streamon':
videobuf2-core.c:(.text.vb2_core_streamon+0x1b4): undefined reference to `v4l_vb2q_enable_media_source'
drivers/media/v4l2-core/videobuf2-v4l2.o: In function `vb2_ioctl_reqbufs':
videobuf2-v4l2.c:(.text.vb2_ioctl_reqbufs+0xc): undefined reference to `video_devdata'
This adds back an explicit dependency.
Fixes: 3050b9985024 ("[media] media: platform: pxa_camera: move pxa_camera out of soc_camera") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Wagner [Fri, 16 Sep 2016 11:18:22 +0000 (08:18 -0300)]
[media] lirc_imon: use complete() instead complete_all()
There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().
While we are at it, we do a small optimization with the
reinitialization of the completion before we use it.
Daniel Wagner [Fri, 16 Sep 2016 11:18:21 +0000 (08:18 -0300)]
[media] imon: use complete() instead of complete_all()
There is only one waiter for the completion, therefore there is no need
to use complete_all(). Let's make that clear by using complete() instead
of complete_all().
While we are at it, we do a small optimization with the reinitialization
of the completion before we use it.
Documentation states that the "default-input" property should reside
directly in the node of the device. This adjusts the parsing to make the
implementation consistent with the documentation.
Based on patch by William Towle <william.towle@codethink.co.uk>.
[media] media: i2c: tvp514x: Reported mbus format should be MEDIA_BUS_FMT_UYVY8_2X8
The advertised V4L2 pixel format and Media Bus code don't match.
The current media bud code advertised is MEDIA_BUS_FMT_YUYV8_2X8
which does not reflect what the encoder actually outputs.
This encoder generate MEDIA_BUS_FMT_UYVY8_2X8 so advertise as such.
Nicolas Iooss [Sat, 10 Sep 2016 16:59:49 +0000 (13:59 -0300)]
[media] ite-cir: initialize use_demodulator before using it
Function ite_set_carrier_params() uses variable use_demodulator after
having initialized it to false in some if branches, but this variable is
never set to true otherwise.
This bug has been found using clang -Wsometimes-uninitialized warning
flag.
Fixes: 620a32bba4a2 ("[media] rc: New rc-based ite-cir driver for
several ITE CIRs")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Nicolas Iooss [Sat, 10 Sep 2016 16:49:01 +0000 (13:49 -0300)]
[media] mb86a20s: always initialize a return value
In mb86a20s_read_status_and_stats(), when mb86a20s_read_status() fails,
the function returns the value in variable rc without initializing it
first. Fix this by propagating the error code from variable status_nr.
This bug has been found using clang and -Wsometimes-uninitialized
warning flag.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Tue, 6 Sep 2016 12:44:09 +0000 (09:44 -0300)]
[media] variable name is never null, so remove null check
The variable name is always assigned to a literal string in the
proceeding switch statement, so it is never null and hence the
null check is redundant. Remove null the check.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
We get 1 warning when building kernel with W=1:
drivers/media/platform/coda/coda-h264.c:22:5: warning: no previous prototype for 'coda_h264_padding' [-Wmissing-prototypes]
In fact, this function is declared in coda.h, so this patch
add missing header dependencies.
Colin Ian King [Sat, 3 Sep 2016 17:04:17 +0000 (14:04 -0300)]
[media] cx24120: do not allow an invalid delivery system types
cx24120_set_frontend currently allows invalid delivery system types
other than SYS_DVBS2 and SYS_DVBS. Fix this by returning -EINVAL
for invalid values.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Jemma Denson <jdenson@gmail.com>
Henrik Ingo [Sun, 29 May 2016 20:58:00 +0000 (17:58 -0300)]
[media] uvcvideo: uvc_scan_fallback() for webcams with broken chain
Some devices have invalid baSourceID references, causing uvc_scan_chain()
to fail, but if we just take the entities we can find and put them
together in the most sensible chain we can think of, turns out they do
work anyway. Note: This heuristic assumes there is a single chain.
At the time of writing, devices known to have such a broken chain are
- Acer Integrated Camera (5986:055a)
- Realtek rtl157a7 (0bda:57a7)
For those cameras that were missing descriptions, update using
some web research:
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_STV0680.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_ZC3XX.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_KINECT.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SPCA561.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_VICAM.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_DTCS033.html
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/564979
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_PAC7302.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SONIXB.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SONIXJ.html
[media] gspca-cardlist.rst: update cardlist from drivers USB IDs
There are several missing USB IDs that are defined on gspca
drivers. Add them.
The missing entries were found/created using the following script:
<script>
use strict;
use File::Find;
my $src = "drivers/media/usb/gspca/";
my $table = 0;
my %data;
my $id;
my $len = 0;
open IN, "Documentation/media/v4l-drivers/gspca-cardlist.rst";
while (<IN>) {
if (m/^=+\s+=+\s+=+$/) {
$table++;
next;
}
next if ($table != 2);
if (m/^(\S+)\s+(\S+)\s+(.*)/) {
$id = "$1_$2";
$data{$id}->{driver} = $1;
$data{$id}->{usb_id} = $2;
$data{$id}->{name} = $3;
$data{$id}->{valid} = 0;
$len = length($3) if (length($3) > $len);
}
}
close IN;
sub parse_dir {
my $file = $File::Find::name;
open IN, $file;
my $driver = $file;
$driver =~ s,($src),,;
$driver =~ s,/.*,,;
$driver =~ s,\.c$,,;
while (<IN>) {
next if (m,/\*.*USB_DEVICE,);
if (m/USB_DEVICE[^\(]*\(\s*0x(\S+)\s*\,\s*0x(\S+)\)(.*)/) {
my $n = "$1:$2";
my $o = $3;
$id = "${driver}_$n";
[media] gspca-cardlist.rst: sort entries and adjust table margins
Some entries are out of order.
While here, clear spaces/tabs.
The content remains the same, with the exeption of one duplicated
entry from the same driver, where two different brand names share
the same entry. The content of such cell was merged, using a
comma.
[media] spca506: rewrite a commented line to avoid wrong parsing
Keeping Documentation/media/v4l-drivers/gspca-cardlist.rst in
sync with the gspca script requires a parser. Simplify the
commented line, to make the parser work better.
[media] v4l: vsp1: Add support for capture and output in HSV formats
Support both the HSV24 and HSV32 formats. From a hardware point of view
pretend the formats are RGB, the RPF and WPF will just pass the data
through without performing any processing.
precalculate_color() had a optimization that avoided duplicated
conversion for YUV formats. This optimization did not take into
consideration YUV444, YUV555, YUV565 or limited range quantization.
This patch keeps the optimization, but fixes the wrong handling.
These formats store the color information of the image
in a geometrical representation. The colors are mapped into a
cylinder, where the angle is the HUE, the height is the VALUE
and the distance to the center is the SATURATION. This is a very
useful format for image segmentation algorithms.
Sakari Ailus [Wed, 14 Sep 2016 15:29:23 +0000 (12:29 -0300)]
[media] smiapp: Implement support for autosuspend
Delay suspending the device by 1000 ms by default. This is done on
explicit power off through s_power() callback, through releasing the
file descriptor, NVM read or when the probe finishes.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Thu, 8 Sep 2016 13:50:07 +0000 (10:50 -0300)]
[media] smiapp-pll: Don't complain aloud about failing PLL calculation
Don't complain about a failure to compute the pre_pll divisor. The
function is used to determine whether a particular combination of bits per
sample value and a link frequency can be used, in which case there are
lots of unnecessary driver messages. During normal operation the failure
generally does not happen. Use dev_dbg() instead.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Thu, 8 Sep 2016 08:49:27 +0000 (05:49 -0300)]
[media] smiapp: Obtain correct media bus code for try format
The media bus code obtained for try format may have been a code that the
sensor did not even support. Use a supported code with the current pixel
order.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Mon, 5 Sep 2016 11:18:34 +0000 (08:18 -0300)]
[media] smiapp: Obtain frame layout from the frame descriptor
Besides the image data, SMIA++ compliant sensors also provide embedded
data in form of registers used to capture the image. Store this
information for later use in frame descriptor and routing.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Wed, 7 Sep 2016 11:55:34 +0000 (08:55 -0300)]
[media] smiapp: Unify setting up sub-devices
The initialisation of the source sub-device is somewhat different as it's
not created by the smiapp driver itself. Remove redundancy in initialising
the two kind of sub-devices.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Wed, 7 Sep 2016 10:37:47 +0000 (07:37 -0300)]
[media] smiapp: Read frame format earlier
The information gathered during frame format reading will be required
earlier in the initialisation when it was available. Also return an error
if frame format cannot be obtained.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Mon, 19 Sep 2016 21:41:14 +0000 (18:41 -0300)]
[media] smiapp: Fix resource management in registration failure
If the registered() callback failed, resources were left unaccounted for.
Fix this, as well as add unregistering the sub-devices in driver
unregistered() callback.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>