Dikshita Agarwal [Tue, 15 Dec 2020 18:08:36 +0000 (19:08 +0100)]
media: venus: core: add support to dump FW region
Add support to dump video FW region during FW crash
using devcoredump helpers.
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zou Wei [Thu, 14 Jan 2021 09:05:21 +0000 (10:05 +0100)]
media: venus: Mark bufreq_enc with static keyword
Fix the following sparse warning:
hfi_plat_bufs_v6.c:1242:5: warning: symbol 'bufreq_enc' was not declared.
Should it be static?
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Colin Ian King [Fri, 15 Jan 2021 10:11:26 +0000 (11:11 +0100)]
media: venus: Fix uninitialized variable count being checked for zero
In the case where plat->codecs is NULL the variable count is uninitialized
but is being checked to see if it is 0. Fix this by initializing
count to 0.
Addresses-Coverity: ("Uninitialized scalar variable")
Fixes:
e29929266be1 ("media: venus: Get codecs and capabilities from hfi platform")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:06 +0000 (12:01 +0100)]
media: allegro: add support for HEVC encoding
The Allegro Codec supports HEVC encoding. The messages to the MCU are
the same for H.264 and HEVC, but some options have to be changed. These
are actually only a few options.
The driver, however, must add the HEVC VPS/SPS/PPS NAL Units to the
coded stream and must properly provide the HEVC format and controls to
user space.
[hverkuil: fix warning for wrong enum type (h264 instead of hevc)]
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:05 +0000 (12:01 +0100)]
media: allegro: activate v4l2-ctrls only for current codec
These controls are specific to H.264 and shall only be activated, if the
coded format is H.264.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:04 +0000 (12:01 +0100)]
media: allegro: increase offset in CAPTURE buffer
The HEVC Non-VCL NAL units require more space than the H.264 Non-VCL NAL
units. Therefore, the driver needs to reserve more space in front of the
actual coded data that is written by the hardware codec.
Increase the offset that shall be used by the hardware codec from 64
bytes to 128 bytes which is as arbitrary as before.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:03 +0000 (12:01 +0100)]
media: allegro: rename codec specific functions
The maximum bitrate and the size of the CPB are dependent on the level.
As the levels differ between the different codecs, the functions to get
the maximum bitrate and CPB must be codec specific, too.
Rename the functions to make it obvious that the function are only valid
for H.264.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:02 +0000 (12:01 +0100)]
media: allegro: add helper to get entropy mode
The driver only supports CAVLC for H.264, but HEVC only uses CABAC. As
the driver has to explicitly tell the MCU to use CABAC for HEVC, add a
helper function to get the entropy mode.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:01 +0000 (12:01 +0100)]
media: allegro: use accessor functions for QP values
V4L2 specifies different controls for the QP values of different codecs.
Simplify users that just care for the QP values by providing accessor
function that return the correct control based on the currently set
codec.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:01:00 +0000 (12:01 +0100)]
media: allegro: remove profile and level from channel
The profile and level are straight copies from the v4l2-ctrls. Avoid
duplication and directly read the value of the v4l2-ctrl.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:59 +0000 (12:00 +0100)]
media: allegro: remove cpb_size and gop_size from channel
The cpb_size and the gop_size are straight copies of the values in the
v4l2-ctrls. To avoid this duplication, directly get the values from the
v4l2-ctrls and remove the copies.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:58 +0000 (12:00 +0100)]
media: allegro: implement scaling of cpb size in SPS
The cbp_size_value_minus1 in the SPS can scaled using cpb_size_scale to
reduce the number of bits necessary to encode the value. For simplicity,
the scaling was set to 1.
Restructure to the code to make it easier to drop the cbp_size from the
channel and as we are at it, also properly implement the scaling.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:57 +0000 (12:00 +0100)]
media: allegro: initialize bitrate using v4l2_ctrl
As the driver now uses the v4l2-ctrls to setup the channel, there is no
need to explicitly set the bitrate. The initial bitrate is now set via
the same path as if it is set from userspace using the v4l2-ctrl.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:56 +0000 (12:00 +0100)]
media: allegro: use handler_setup to configure channel
v4l2_ctrl_handler_setup() calls s_ctrl for all controls of the handler.
This ensures that the channel is initialized using the default values of
the v4l2-ctrls.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:55 +0000 (12:00 +0100)]
media: allegro: fix log2_max_poc in firmware 2019.1
The log2_max_poc field is used to set log2_max_pic_order_cnt_lsb_minus4
for the coded stream. It has an allowed range of 0 to 12.
param contains the value without the minus4, but since firmware
version 2019.1, the value has to be log2_max_pic_order_cnt_lsb - 1,
presumably to fit the maximum value of 16 into a 4 bit field.
The driver does not support firmware version 2019.1. Thus, change the
behaviour starting from firmware version 2019.2.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:54 +0000 (12:00 +0100)]
media: allegro: move encoding options to channel
There are several encoding options that are hard coded in the parameter
that is used to configure the hardware codec. However, some of the
options must be written to the SPS/PPS by the driver. Furthermore, some
of the options depend on the codec that is used (i.e. H.264 or HEVC).
Therefore, move options that depend on the codec to the channel and add
constants for options that are independent of the codec but must be
written to the SPS/PPS.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:53 +0000 (12:00 +0100)]
media: allegro: adjust channel after format change
A format change (i.e. the frame size or the codec) has multiple effects
on a channel:
- The available controls
- The limits of the available controls
- The default encoding options
To avoid scattering the changes all over the driver, add a new function
that goes over the channel and does all required adjustments.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Fri, 15 Jan 2021 09:34:59 +0000 (10:34 +0100)]
media: allegro: implement S_FMT for CAPTURE
In order to support different codecs, the driver must support changing
the format on CAPTURE. Therefore, the driver needs to handle S_FMT on
CAPTURE.
As the driver will have a different number of formats for OUTPUT and
CAPTURE, split the check for the format index in ENUM_FMT into CAPTURE
and OUTPUT.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:51 +0000 (12:00 +0100)]
media: allegro: add HEVC NAL unit generator
When encoding a video as HEVC, the allegro driver needs to generate the
Non-VCL NAL units for HEVC. Do the same as for H.264 and add a module
that takes C structs for the VPS/SPS/PPS and encodes the fields as RBPS
as specified by "ITU-T Rec. H.265 (02/2018) high efficiency video
coding".
[hverkuil: add missing static for nal_hevc_write/read_start_code_prefix]
[hverkuil: fix typo: pps -> vps in nal_hevc_write_vps]
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:50 +0000 (12:00 +0100)]
media: allegro: add helper to report unsupported fields
Allow generators to explicitly signal an error if the C structs contain
unsupported or invalid fields.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Michael Tretter [Thu, 3 Dec 2020 11:00:49 +0000 (12:00 +0100)]
media: allegro: extract RBSP handler from H.264 NAL generator
The RBSP structure is the same for HEVC and H.264. In order to be able
to reuse the RBSP handler for generating HEVC NAL units, extract the
functions from the H.264 generator.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jacopo Mondi [Fri, 15 Jan 2021 10:16:52 +0000 (11:16 +0100)]
media: dt-bindings: media: ov5647: Fix filename
Commit
1b5071af8240 ("media: dt-bindings: media: i2c: Rename
ov5647.yaml") renamed the bindings file but did not update the
Id: field there.
Fix it by using the new filename.
Fixes:
1b5071af8240 ("media: dt-bindings: media: i2c: Rename ov5647.yaml")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Laurent Pinchart [Thu, 7 Jan 2021 22:54:58 +0000 (23:54 +0100)]
media: v4l2-async: Safely unregister an non-registered async subdev
Make the V4L2 async framework a bit more robust by allowing to
unregister a non-registered async subdev. Otherwise the
v4l2_async_cleanup() will attempt to delete the async subdev from the
subdev_list with the corresponding list_head not initialized.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Lad Prabhakar [Wed, 20 Jan 2021 09:01:48 +0000 (10:01 +0100)]
media: i2c/Kconfig: Select FWNODE for OV772x sensor
Fix OV772x build breakage by selecting V4L2_FWNODE config:
ia64-linux-ld: drivers/media/i2c/ov772x.o: in function `ov772x_probe':
ov772x.c:(.text+0x1ee2): undefined reference to `v4l2_fwnode_endpoint_alloc_parse'
ia64-linux-ld: ov772x.c:(.text+0x1f12): undefined reference to `v4l2_fwnode_endpoint_free'
ia64-linux-ld: ov772x.c:(.text+0x2212): undefined reference to `v4l2_fwnode_endpoint_alloc_parse'
Fixes:
8a10b4e3601e ("media: i2c: ov772x: Parse endpoint properties")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Fri, 8 Jan 2021 17:17:28 +0000 (18:17 +0100)]
media: v4l2-async: Add waiting subdevices debugfs
There is currently little to no information available about the reasons
why a v4l2-async device hasn't probed completely.
Inspired by the "devices_deferred" debugfs file, add a file to list
information about the subdevices that are on waiting lists, for each
notifier.
This is useful to debug v4l2-async subdevices and notifiers, for instance
when doing device bring-up.
For instance, a typical output would be:
$ cat /sys/kernel/debug/video4linux/pending_async_subdevices
ipu1_csi1:
[fwnode] dev=20e0000.iomuxc-gpr:ipu1_csi1_mux, node=/soc/bus@2000000/iomuxc-gpr@20e0000/ipu1_csi1_mux
ipu1_csi0:
[fwnode] dev=20e0000.iomuxc-gpr:ipu1_csi0_mux, node=/soc/bus@2000000/iomuxc-gpr@20e0000/ipu1_csi0_mux
imx6-mipi-csi2:
[fwnode] dev=1-003c, node=/soc/bus@2100000/i2c@21a4000/camera@3c
imx-media:
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Fri, 8 Jan 2021 17:17:27 +0000 (18:17 +0100)]
media: v4l2-async: Remove V4L2_ASYNC_MATCH_CUSTOM
Custom/driver-specific v4l2-async match support was introduced
in 2013, as V4L2_ASYNC_BUS_CUSTOM.
This type of match never had any user, so it's fair
to conclude it's not required and that safe for removal.
If the support is ever needed, it can always be restored.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Joe Perches [Wed, 23 Dec 2020 13:35:27 +0000 (14:35 +0100)]
media: uvcvideo: Rename debug functions
trace isn't a good name as it's not a trace mechanism, it is a
typical debug mechanism.
Rename uvc_trace/uvc_trace_cont macros to uvc_dbg/uvc_dbg_cont.
Rename uvc_trace_param to uvc_dbg_param
Rename UVC_TRACE_<FOO> defines to UVC_DBG_<FOO>
Use ## concatenation in uvc_dbg macros to avoid overly long and
repetitive UVC_DBG uses
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:26 +0000 (14:35 +0100)]
media: uvcvideo: use dev_printk() for uvc_trace()
Instead of calling prink() inside uvc_trace, use dev_printk(), which adds
context to the output.
Now that we are at it, regroup the strings so the messages can be easily
"grepable".
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:25 +0000 (14:35 +0100)]
media: uvcvideo: New macro uvc_trace_cont
Remove all the duplicated code around printk(KERN_CONT, with a new macro.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:24 +0000 (14:35 +0100)]
media: uvcvideo: Use dev_ printk aliases
Replace all the uses of printk() and uvc_printk() with its
equivalent dev_ alias macros.
Modify uvc_warn_once() macro to use dev_info instead printk().
They are more standard across the kernel tree and provide
more context about the error.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:23 +0000 (14:35 +0100)]
media: uvcvideo: Add Privacy control based on EXT_GPIO
Add a new control and mapping for Privacy controls connected to
UVC_GUID_EXT_GPIO_CONTROLLERs.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:22 +0000 (14:35 +0100)]
media: uvcvideo: Implement UVC_EXT_GPIO_UNIT
Some devices can implement a physical switch to disable the input of the
camera on demand. Think of it like an elegant privacy sticker.
The system can read the status of the privacy switch via a GPIO.
It is important to know the status of the switch, e.g. to notify the
user when the camera will produce black frames and a videochat
application is used.
In some systems, the GPIO is connected to the main SoC instead of the
camera controller, with the connection reported by the system firmware
(ACPI or DT). In that case, the UVC device isn't aware of the GPIO. We
need to implement a virtual entity to handle the GPIO fully on the
driver side.
For example, for ACPI-based systems, the GPIO is reported in the USB
device object:
Scope (\_SB.PCI0.XHCI.RHUB.HS07)
{
/.../
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
"\\_SB.PCI0.GPIO", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0064
}
})
Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
{
ToUUID ("
daffd814-6eba-4d8c-8a91-
bc9bbf4aa301") /* Device Properties for _DSD */,
Package (0x01)
{
Package (0x02)
{
"privacy-gpio",
Package (0x04)
{
\_SB.PCI0.XHCI.RHUB.HS07,
Zero,
Zero,
One
}
}
}
})
}
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:21 +0000 (14:35 +0100)]
media: uvcvideo: Allow entity-defined get_info and get_cur
Allows controls to get their properties and current value
from an entity-defined function instead of via a query to the USB
device.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:20 +0000 (14:35 +0100)]
media: uvcvideo: Provide sync and async uvc_ctrl_status_event
Split the functionality of void uvc_ctrl_status_event_work in two, so it
can be called by functions outside interrupt context and not part of an
URB.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:19 +0000 (14:35 +0100)]
media: uvcvideo: Allow entities with no pads
Avoid an underflow while calculating the number of inputs for entities
with zero pads.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:18 +0000 (14:35 +0100)]
media: uvcvideo: Allow extra entities
Increase the size of the id, to avoid collisions with entities
implemented by the driver that are not part of the UVC device.
Entities exposed by the UVC device use IDs 0-255, extra entities
implemented by the driver (such as the GPIO entity) use IDs 256 and
up.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Wed, 23 Dec 2020 13:35:17 +0000 (14:35 +0100)]
media: uvcvideo: Move guid to entity
Instead of having multiple copies of the entity guid on the code, move
it to the entity structure.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Laurent Pinchart [Sun, 20 Dec 2020 14:11:13 +0000 (15:11 +0100)]
media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values
The Renkforce RF AC4K 300 Action Cam 4K reports invalid bFormatIndex and
bFrameIndex values when negotiating the video probe and commit controls.
The UVC descriptors report a single supported format and frame size,
with bFormatIndex and bFrameIndex both equal to 2, but the video probe
and commit controls report bFormatIndex and bFrameIndex set to 1.
The device otherwise operates correctly, but the driver rejects the
values and fails the format try operation. Fix it by ignoring the
invalid indices, and assuming that the format and frame requested by the
driver are accepted by the device.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=210767
Fixes:
8a652a17e3c0 ("media: uvcvideo: Ensure all probed info is returned to v4l2")
Reported-by: Till Dörges <doerges@pre-sense.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Laurent Pinchart [Fri, 20 Nov 2020 10:57:48 +0000 (11:57 +0100)]
media: uvcvideo: Force UVC version to 1.0a for 1bcf:0b40
The Shenzhen Aoni Electronic Co.,Ltd 2K FHD camera reports a UVC 1.10
version, but implements UVC 1.0a as shown by the UVC probe control being
26 bytes long. Force the UVC version for that device.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Doncho Minkov <donchominkov@gmail.com>
Tested-by: Doncho Minkov <donchominkov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Thu, 21 Jan 2021 06:44:00 +0000 (07:44 +0100)]
media: zr364xx: fix memory leaks in probe()
Syzbot discovered that the probe error handling doesn't clean up the
resources allocated in zr364xx_board_init(). There are several
related bugs in this code so I have re-written the error handling.
1) Introduce a new function zr364xx_board_uninit() which cleans up
the resources in zr364xx_board_init().
2) In zr364xx_board_init() if the call to zr364xx_start_readpipe()
fails then release the "cam->buffer.frame[i].lpvbits" memory
before returning. This way every function either allocates
everything successfully or it cleans up after itself.
3) Re-write the probe function so that each failure path goto frees
the most recent allocation. That way we don't free anything
before it has been allocated and we can also verify that
everything is freed.
4) Originally, in the probe function the "cam->v4l2_dev.release"
pointer was set to "zr364xx_release" near the start but I moved
that assignment to the end, after everything had succeeded. The
release function was never actually called during the probe cleanup
process, but with this change I wanted to make it clear that we
don't want to call zr364xx_release() until everything is
allocated successfully.
Next I re-wrote the zr364xx_release() function. Ideally this would
have been a simple matter of copy and pasting the cleanup code from
probe and adding an additional call to video_unregister_device(). But
there are a couple quirks to note.
1) The probe function does not call videobuf_mmap_free() and I don't
know where the videobuf_mmap is allocated. I left the code as-is to
avoid introducing a bug in code I don't understand.
2) The zr364xx_board_uninit() has a call to zr364xx_stop_readpipe()
which is a change from the original behavior with regards to
unloading the driver. Calling zr364xx_stop_readpipe() on a stopped
pipe is not a problem so this is safe and is potentially a bugfix.
Reported-by: syzbot+b4d54814b339b5c6bbd4@syzkaller.appspotmail.com
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Sat, 16 Jan 2021 16:40:38 +0000 (17:40 +0100)]
media: imx6-mipi-csi2: Call remote subdev get_mbus_config to get active lanes
Currently, the CSI2 subdevice is using the data-lanes from the
neareast endpoint to config the CSI2 lanes.
While this may work, the proper way to configure the hardware is
to obtain the remote subdevice in v4l2_async_notifier_operations.bound(),
and then call get_mbus_config using the remote subdevice to get
the active lanes.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Fri, 15 Jan 2021 21:34:03 +0000 (22:34 +0100)]
media: smipcie: switch from 'pci_' to 'dma_' API
The wrappers in include/linux/pci-dma-compat.h should go away.
The patch has been generated with the coccinelle script below and has been
hand modified to replace GFP_ with a correct flag.
It has been compile tested.
When memory is allocated in 'smi_port_init()' GFP_KERNEL can be used
because this function is called only from the probe function and no lock
is taken in between.
The call chain is:
smi_probe()
--> smi_port_attach()
--> smi_port_init()
@@
@@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL
@@
@@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE
@@
@@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE
@@
@@
- PCI_DMA_NONE
+ DMA_NONE
@@
expression e1, e2, e3;
@@
- pci_alloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3;
@@
- pci_zalloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3, e4;
@@
- pci_free_consistent(e1, e2, e3, e4)
+ dma_free_coherent(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_single(e1, e2, e3, e4)
+ dma_map_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_single(e1, e2, e3, e4)
+ dma_unmap_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4, e5;
@@
- pci_map_page(e1, e2, e3, e4, e5)
+ dma_map_page(&e1->dev, e2, e3, e4, e5)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_page(e1, e2, e3, e4)
+ dma_unmap_page(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_sg(e1, e2, e3, e4)
+ dma_map_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_sg(e1, e2, e3, e4)
+ dma_unmap_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+ dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_device(e1, e2, e3, e4)
+ dma_sync_single_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+ dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+ dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2;
@@
- pci_dma_mapping_error(e1, e2)
+ dma_mapping_error(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_dma_mask(e1, e2)
+ dma_set_mask(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_consistent_dma_mask(e1, e2)
+ dma_set_coherent_mask(&e1->dev, e2)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
ivan tkachenko [Wed, 23 Dec 2020 21:43:54 +0000 (22:43 +0100)]
media: hdmi: cec: replace broken link to HDMI specs
Current link died, according to Wayback Machine, back in 2017. And the
website is completely down since 2019. Moreover, there was a custom
cover on that PDF, i.e. it was modified.
According to HDMI licence agreement (LA), HDMI specification and technical
information are supposed to be hosted on www.hdmi.org exclusively, and not
redistributed by third-parties.
Sure, there are still many more or less reliable "mirrors" out there with
a direct download straight from a search engine's page. However, for
example, from FPGA4fun[1] website it was removed "per HDMI LA request".
Unfortunately, the official download page is protected by email CAPTCHA,
but that seems to be the only legit way to obtain a copy.
[1] https://www.fpga4fun.com/HDMI.html
Signed-off-by: ivan tkachenko <me@ratijas.tk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Maxim Plotnikov [Tue, 1 Dec 2020 00:14:27 +0000 (01:14 +0100)]
media: Fix RTL2832 not depending on REGMAP_I2C
Prevents this compile time error:
ERROR: modpost: "__regmap_init_i2c" [drivers/media/dvb-frontends/rtl2832.ko] undefined!
Signed-off-by: Maxim Plotnikov <wgh@torlan.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Niklas Söderlund [Fri, 15 Jan 2021 00:21:46 +0000 (01:21 +0100)]
media: rcar-vin: Route events to correct video device
The event route for VIN running with a media controller (Gen3) is
incorrect as all events are only routed to the video device that are
used to register the async notifier.
Remedy this be examining which subdevice generated the event and route
it to all VIN(s) that are connected to that subdevice.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Niklas Söderlund [Fri, 15 Jan 2021 00:21:45 +0000 (01:21 +0100)]
media: rcar-vin: Do not try to stop stream if not running
Do not attempt to stop the streaming if the stream is not running.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Helen Koike [Thu, 14 Jan 2021 18:01:49 +0000 (19:01 +0100)]
media: videobuf2-v4l2: remove redundant error test
request_fd is validated under media_request_get_by_fd() just below this
check. Thus remove it.
Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Helen Koike [Thu, 14 Jan 2021 18:01:47 +0000 (19:01 +0100)]
media: v4l2-ioctl: print capabilities in v4l_print_create_buffers()
Print capabilities field from struct v4l2_create_buffers for better
debugging.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tom Rix [Mon, 18 Jan 2021 13:45:13 +0000 (14:45 +0100)]
media: pxa_camera: declare variable when DEBUG is defined
When DEBUG is defined this error occurs
drivers/media/platform/pxa_camera.c:1410:7: error:
‘i’ undeclared (first use in this function)
for (i = 0; i < vb->num_planes; i++)
^
The variable 'i' is missing, so declare it.
Fixes:
6f28435d1c15 ("[media] media: platform: pxa_camera: trivial move of functions")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tom Rix [Sun, 17 Jan 2021 22:21:38 +0000 (23:21 +0100)]
media: mtk-vcodec: fix argument used when DEBUG is defined
When DEBUG is defined this error occurs
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c:306:41:
error: ‘i’ undeclared (first use in this function)
mtk_v4l2_debug(2, "reg[%d] base=0x%p", i, dev->reg_base[VENC_SYS]);
Reviewing the old line
mtk_v4l2_debug(2, "reg[%d] base=0x%p", i, dev->reg_base[i]);
All the i's need to be changed to VENC_SYS.
Fix a similar error for VENC_LT_SYS.
Fixes:
0dc4b3286125 ("media: mtk-vcodec: venc: support SCP firmware")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Sat, 16 Jan 2021 21:21:46 +0000 (22:21 +0100)]
media: cx25821: Fix a bug when reallocating some dma memory
This function looks like a realloc.
However, if 'risc->cpu != NULL', the memory will be freed, but never
reallocated with the bigger 'size'.
Explicitly set 'risc->cpu' to NULL, so that the reallocation is
correctly performed a few lines below.
[hverkuil: NULL != risc->cpu -> risc->cpu]
Fixes:
5ede94c70553 ("[media] cx25821: remove bogus btcx_risc dependency)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Fri, 15 Jan 2021 21:24:15 +0000 (22:24 +0100)]
media: saa7164: switch from 'pci_' to 'dma_' API
The wrappers in include/linux/pci-dma-compat.h should go away.
The patch has been generated with the coccinelle script below and has been
hand modified to replace GFP_ with a correct flag.
It has been compile tested.
When memory is allocated in 'saa7164_buffer_alloc()' GFP_KERNEL can be used
because this function is already using this flag just a few lines above.
@@
@@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL
@@
@@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE
@@
@@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE
@@
@@
- PCI_DMA_NONE
+ DMA_NONE
@@
expression e1, e2, e3;
@@
- pci_alloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3;
@@
- pci_zalloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3, e4;
@@
- pci_free_consistent(e1, e2, e3, e4)
+ dma_free_coherent(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_single(e1, e2, e3, e4)
+ dma_map_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_single(e1, e2, e3, e4)
+ dma_unmap_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4, e5;
@@
- pci_map_page(e1, e2, e3, e4, e5)
+ dma_map_page(&e1->dev, e2, e3, e4, e5)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_page(e1, e2, e3, e4)
+ dma_unmap_page(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_sg(e1, e2, e3, e4)
+ dma_map_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_sg(e1, e2, e3, e4)
+ dma_unmap_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+ dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_device(e1, e2, e3, e4)
+ dma_sync_single_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+ dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+ dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2;
@@
- pci_dma_mapping_error(e1, e2)
+ dma_mapping_error(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_dma_mask(e1, e2)
+ dma_set_mask(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_consistent_dma_mask(e1, e2)
+ dma_set_coherent_mask(&e1->dev, e2)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Tue, 12 Jan 2021 12:20:53 +0000 (13:20 +0100)]
media: mtk-vcodec: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
[hverkuil: drop unused variable i]
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Tue, 12 Jan 2021 12:20:52 +0000 (13:20 +0100)]
media: sun4i-csi: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Mon, 11 Jan 2021 14:54:44 +0000 (15:54 +0100)]
media: vicodec: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Mon, 11 Jan 2021 14:54:43 +0000 (15:54 +0100)]
media: ti-vpe: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Cc: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Mon, 11 Jan 2021 14:54:41 +0000 (15:54 +0100)]
media: jpu: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Cc: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Mon, 11 Jan 2021 14:54:40 +0000 (15:54 +0100)]
media: fdp1: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Mon, 11 Jan 2021 14:54:38 +0000 (15:54 +0100)]
media: mtk-mdp: Do not zero reserved fields
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check commit
4e1e0eb0e074 ("media: v4l2-ioctl: Zero
v4l2_plane_pix_format reserved fields").
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Arnd Bergmann [Thu, 3 Dec 2020 23:17:03 +0000 (00:17 +0100)]
media: rc: select CONFIG_BITREVERSE where needed
A number of remote control drivers require the bitreverse
helper, and run into a link error when it is disabled:
arm-linux-gnueabi-ld: drivers/media/rc/img-ir/img-ir-nec.o: in function `img_ir_nec_scancode':
img-ir-nec.c:(.text+0x10c): undefined reference to `byte_rev_table'
arm-linux-gnueabi-ld: drivers/media/rc/img-ir/img-ir-nec.o: in function `img_ir_nec_filter':
img-ir-nec.c:(.text+0x2dc): undefined reference to `byte_rev_table'
arm-linux-gnueabi-ld: drivers/media/usb/cx231xx/cx231xx-input.o: in function `get_key_isdbt':
cx231xx-input.c:(.text+0x38c): undefined reference to `byte_rev_table'
arm-linux-gnueabi-ld: drivers/media/usb/em28xx/em28xx-input.o: in function `em28xx_get_key_em_haup':
em28xx-input.c:(.text+0x1704): undefined reference to `byte_rev_table'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Evan Benn [Thu, 26 Nov 2020 03:08:42 +0000 (04:08 +0100)]
media: mtk-vcodec: Fix order of log arguments
Fix order of log arguments.
[hverkuil: fix checkpatch parenthesis alignment warnings]
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Luo Meng [Wed, 25 Nov 2020 01:34:37 +0000 (02:34 +0100)]
media: qm1d1c0042: fix error return code in qm1d1c0042_init()
Fix to return a negative error code from the error handling case
instead of 0 in function qm1d1c0042_init(), as done elsewhere
in this function.
Fixes:
ab4d14528fdf ("[media] em28xx: add support for PLEX PX-BCUD (ISDB-S)")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Acked-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:37:08 +0000 (19:37 +0100)]
media: saa7134: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
[hverkuil: fix checkpatch TAB indendation issues]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:37:02 +0000 (19:37 +0100)]
media: rcar_jpu: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:36:57 +0000 (19:36 +0100)]
media: dvb_frontend: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:36:50 +0000 (19:36 +0100)]
media: atomisp: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:26:16 +0000 (19:26 +0100)]
media: usb: dvb-usb-v2: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding a couple of break statements instead of
just letting the code fall through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:26:09 +0000 (19:26 +0100)]
media: dvb-frontends: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break and a return statements
instead of just letting the code fall through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Fri, 20 Nov 2020 16:27:18 +0000 (17:27 +0100)]
media: atomisp: Fix a buffer overflow in debug code
The "pad" variable is a user controlled string and we haven't properly
clamped it at this point so the debug code could print from beyond the
of the array.
Fixes:
a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jernej Skrabec [Wed, 23 Dec 2020 11:06:58 +0000 (12:06 +0100)]
media: cedrus: Remove checking for required controls
According to v4l2 request api specifications, it's allowed to skip
control if its content isn't changed for performance reasons. Cedrus
driver predates that, so it has implemented mechanism to check if all
required controls are included in one request.
Conform to specifications with removing that mechanism.
Note that this mechanism with static required flag isn't very good
anyway because need for control is usually signaled in other controls.
Fixes:
50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Wed, 6 Jan 2021 03:04:49 +0000 (04:04 +0100)]
media: vidtv: print message when driver is removed
Print a message when the driver is removed so that we get some
visual confirmation when unbinding vidtv.
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Wed, 6 Jan 2021 03:04:48 +0000 (04:04 +0100)]
media: vidtv: use a simpler name in platform_{device|driver}
Change from "vidtv_bridge" to simply "vidtv" so that vidtv looks
more similar to the other media virtual drivers in /sys/bus/platform.
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Wed, 6 Jan 2021 03:04:47 +0000 (04:04 +0100)]
media: vidtv: reinstate sysfs bind attrs
Reinstate sysfs bind attrs so that vidtv can be bound and unbound
via sysfs. This is useful for automated regression testing in
userspace.
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Wed, 6 Jan 2021 03:04:46 +0000 (04:04 +0100)]
media: vidtv: Add media controller support
Add media controller support when CONFIG_MEDIA_CONTROLLER_DVB is set
so that, in the future, a test sequence in v4l-utils can be written
without having to know which /dev/fooX device should be used.
[mchehab: avoided usage of C99 comments]
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tian Tao [Tue, 29 Dec 2020 08:55:30 +0000 (09:55 +0100)]
media: vidtv: Use kmemdup instead of kzalloc and memcpy
Fixes coccicheck warning:
drivers/media/test-drivers/vidtv/vidtv_psi.c:509:10-17: WARNING
opportunity for kmemdup
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Thu, 24 Dec 2020 15:04:01 +0000 (16:04 +0100)]
media: vidtv: remove unused field from 'struct vidtv_mpeg_ts'
Commit
3d1387b3b8f6 ("media: vidtv: fix some warnings") replaced
the unused flexible array member at the end of struct vidtv_mpeg_ts
with a pointer. This broke the 188-byte alignment since the struct
no longer was 4 bytes in size.
Fix this by removing this field entirely.
Fixes:
3d1387b3b8f6 ("media: vidtv: fix some warnings")
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel W. S. Almeida [Thu, 24 Dec 2020 15:04:00 +0000 (16:04 +0100)]
media: vidtv: psi: fix missing crc for PMT
The PMT write function was refactored and this broke the CRC computation.
Fix it.
Fixes:
db9569f67e2e ("media: vidtv: cleanup PMT write table function")
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 09:27:08 +0000 (10:27 +0100)]
media: i2c/ov02a10.c: add cast to fix type mismatch
By adding this cast '(__force __le16)' this sparse warning
is fixed:
drivers/media/i2c/ov02a10.c:391:19: warning: cast to restricted __le16
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 09:11:33 +0000 (10:11 +0100)]
media: atomisp/pci: add missing include
Fix two smatch warnings:
drivers/staging/media/atomisp//pci/ia_css_firmware.h:52:29: warning: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration
drivers/staging/media/atomisp//pci/ia_css_control.h:49:24: warning: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration
Add '#include <linux/device.h>' to ia_css_firmware.h so struct device is defined.
ia_css_control.h includes ia_css_firmware.h, so it is sufficient to
just modify ia_css_firmware.h.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 09:09:05 +0000 (10:09 +0100)]
media: dvb-frontends/af9033.c: fix missing error codes
Fixes two smatch warnings:
drivers/media/dvb-frontends/af9033.c:128 af9033_init() warn: missing error code 'ret'
drivers/media/dvb-frontends/af9033.c:855 af9033_read_snr() warn: missing error code 'ret'
Set error codes correctly.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 09:03:21 +0000 (10:03 +0100)]
media: dvb-frontends/rtl2832.c: fix missing error code
Fixes this smatch warning:
drivers/media/dvb-frontends/rtl2832.c:702 rtl2832_read_status() warn: missing error code 'ret'
'ret' is indeed not set, so set it to -EINVAL so a proper error
code is returned.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:58:38 +0000 (09:58 +0100)]
media: usb/dvb-usb-v2/rtl28xxu.c: clean up code to fix smatch warning
Fixes this smatch warning:
drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1040 rtl2832u_frontend_attach() warn: missing error code 'ret'
It is actually a bogus warning since in this particular case ret isn't
meant to be set. But by reworking the code a bit the code is actually
a lot more understandable and it fixes this warning.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:52:53 +0000 (09:52 +0100)]
media: pci/ivtv: release memory regions on error
Fix this smatch warning:
drivers/media/pci/ivtv/ivtv-driver.c:900 ivtv_setup_pci() warn: 'itv->base_addr' not released on lines: 876.
One error path didn't release the memory regions.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:47:20 +0000 (09:47 +0100)]
media: sti/hva: add missing clk_disable_unprepare()
Fixes this smatch warning:
drivers/media/platform/sti/hva/hva-hw.c:453 hva_hw_runtime_resume() warn: 'hva->clk' not released on lines: 450.
Call clk_disable_unprepare() when clk_set_rate() fails.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:45:23 +0000 (09:45 +0100)]
media: sti/c8sectpfe: set correct return code
Fixes this smatch warning:
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:829 c8sectpfe_probe() warn: missing error code 'ret'
Set ret to -EINVAL if the reset gpio was not found.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:42:38 +0000 (09:42 +0100)]
media: i2c/ov8865.c: fix error checks using wrong variable
Fix two typos: dvdd -> dovdd and dvdd -> avdd
Both clearly copy-and-paste mistakes.
Fixes this smatch warning:
drivers/media/i2c/ov8865.c:2852 ov8865_probe() warn: passing zero to 'PTR_ERR'
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:39:20 +0000 (09:39 +0100)]
media: tuners/it913x.c: fix missing error code
Fixes this smatch warning:
drivers/media/tuners/it913x.c:65 it913x_init() warn: missing error code 'ret'
Set ret to -EINVAL if the clock identifier was invalid.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:36:29 +0000 (09:36 +0100)]
media: davinci/vpbe.c: ret contains the return code, not err
Fixes this smatch warning:
drivers/media/platform/davinci/vpbe.c:632 vpbe_initialize() warn: missing error code 'ret'
The function returns 'ret', but instead 'err' was set to -ENOMEM.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:33:37 +0000 (09:33 +0100)]
media: meson/ge2d: set ret to -ENOMEM
Fix this smatch warning:
drivers/media/platform/meson/ge2d/ge2d.c:991 ge2d_probe() warn: missing error code 'ret'
when video_device_alloc() returns NULL.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 20 Jan 2021 08:28:02 +0000 (09:28 +0100)]
media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate
If a menu has more than 64 items, then don't check menu_skip_mask
for items 65 and up.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+42d8c7c3d3e594b34346@syzkaller.appspotmail.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Fri, 15 Jan 2021 10:36:11 +0000 (11:36 +0100)]
media: atomisp/pci/hmm: fix wrong printk format
Fix this compiler warning on i686:
In file included from include/linux/printk.h:409,
from include/linux/kernel.h:16,
from drivers/staging/media/atomisp/pci/hmm/hmm.c:23:
drivers/staging/media/atomisp/pci/hmm/hmm.c: In function 'hmm_alloc':
drivers/staging/media/atomisp/pci/hmm/hmm.c:272:3: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
272 | "%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use %zu instead of %ld.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Malcolm Priestley [Mon, 24 Aug 2020 21:42:23 +0000 (23:42 +0200)]
media: lmedm04: Remove lme2510_kill_urb function.
This function is not necessary and largely a remnant of
dvb-usb workaround and is now controlled by dvb-usb-v2.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Malcolm Priestley [Sat, 3 Oct 2020 09:32:43 +0000 (11:32 +0200)]
media: lmedm04: Use GFP_KERNEL for URB allocation/submission.
lme2510_int_read is not atomically called so use GFP_KERNEL for
usb_alloc_urb and usb_submit_urb which is the first in the chain
of interrupt submissions.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Joe Perches [Sun, 23 Aug 2020 18:13:31 +0000 (20:13 +0200)]
media: lmedm04: Fix misuse of comma
There's a comma used instead of a semicolon that causes multiple
statements to be executed after an if instead of just the intended
single statement.
Replace the comma with a semicolon.
Fixes:
15e1ce33182d ("[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb")
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Tue, 19 Jan 2021 13:53:50 +0000 (14:53 +0100)]
media: mceusb: sanity check for prescaler value
prescaler larger than 8 would mean the carrier is at most 152Hz,
which does not make sense for IR carriers.
Reported-by: syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Samuel Holland [Mon, 18 Jan 2021 06:00:48 +0000 (07:00 +0100)]
media: sunxi-cir: Implement suspend/resume/shutdown callbacks
To save power, gate/reset the hardware block while the system is
asleep or powered off.
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Samuel Holland [Mon, 18 Jan 2021 06:00:47 +0000 (07:00 +0100)]
media: sunxi-cir: Factor out hardware initialization
In preparation for adding suspend/resume hooks, factor out the hardware
initialization from the driver probe/remove functions.
The timeout programmed during init is taken from the `struct rc_dev` so
it is maintained across an exit/init cycle.
This resolves some trivial issues with the probe function: throwing away
the error from clk_prepare_enable and using the wrong type for the
temporary register value.
It also fixes the order of the remove function to unregister the RC
device before turning off the hardware. This prevents userspace from
triggering register writes (via LIRC_SET_REC_TIMEOUT) while the hardware
is disabled.
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Samuel Holland [Mon, 18 Jan 2021 06:00:46 +0000 (07:00 +0100)]
media: sunxi-cir: Remove unnecessary spinlock
Only one register, SUNXI_IR_CIR_REG, is accessed from outside the
interrupt handler, and that register is not accessed from inside it.
As there is no overlap between different contexts, no lock is needed.
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Samuel Holland [Mon, 18 Jan 2021 06:00:45 +0000 (07:00 +0100)]
media: sunxi-cir: Clean up dead register writes
The register writes during driver removal occur after the device is
already put back in reset, so they never had any effect.
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:38 +0000 (14:28 +0100)]
media: ipu3-cio2: Add cio2-bridge to ipu3-cio2 driver
Currently on platforms designed for Windows, connections between CIO2 and
sensors are not properly defined in DSDT. This patch extends the ipu3-cio2
driver to compensate by building software_node connections, parsing the
connection properties from the sensor's SSDB buffer.
[Sakari Ailus: Make cio2_bridge_init static inline to a fix compiler
warning, wrapped a bunch of long lines.]
Suggested-by: Jordan Hand <jorhand@linux.microsoft.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>