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>
Daniel Scally [Thu, 7 Jan 2021 13:28:37 +0000 (14:28 +0100)]
media: v4l2-fwnode: Include v4l2_fwnode_bus_type
V4L2 fwnode bus types are enumerated in v4l2-fwnode.c, meaning they aren't
available to the rest of the kernel. Move the enum to the corresponding
header so that I can use the label to refer to those values.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.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>
Daniel Scally [Thu, 7 Jan 2021 13:28:36 +0000 (14:28 +0100)]
media: ACPI / bus: Add acpi_dev_get_next_match_dev() and helper macro
To ensure we handle situations in which multiple sensors of the same
model (and therefore _HID) are present in a system, we need to be able
to iterate over devices matching a known _HID but unknown _UID and _HRV
- add acpi_dev_get_next_match_dev() to accommodate that possibility and
change acpi_dev_get_first_match_dev() to simply call the new function
with a NULL starting point. Add an iterator macro for convenience.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:35 +0000 (14:28 +0100)]
media: v4l2-core: v4l2-async: Check sd->fwnode->secondary in match_fwnode()
Where the fwnode graph is comprised of software_nodes, these will be
assigned as the secondary to dev->fwnode. Check the v4l2_subdev's fwnode
for a secondary and attempt to match against it during match_fwnode() to
accommodate that possibility.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@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>
Daniel Scally [Thu, 7 Jan 2021 13:28:34 +0000 (14:28 +0100)]
media: ipu3-cio2: Rename ipu3-cio2.c
ipu3-cio2 driver needs extending with multiple files; rename the main
source file and specify the renamed file in Makefile to accommodate that.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.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>
Daniel Scally [Thu, 7 Jan 2021 13:28:33 +0000 (14:28 +0100)]
media: ipu3-cio2: Add T: entry to MAINTAINERS
Development for the ipu3-cio2 driver is taking place in media_tree, but
there's no T: entry in MAINTAINERS to denote that - rectify that oversight
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.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>
Daniel Scally [Thu, 7 Jan 2021 13:28:32 +0000 (14:28 +0100)]
media: lib/test_printf.c: Use helper function to unwind array of software_nodes
Use the software_node_unregister_nodes() helper function to unwind this
array in a cleaner way.
Acked-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.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>
Heikki Krogerus [Thu, 7 Jan 2021 13:28:31 +0000 (14:28 +0100)]
media: software_node: Add support for fwnode_graph*() family of functions
This implements the remaining .graph_*() callbacks in the fwnode
operations structure for the software nodes. That makes the
fwnode_graph_*() functions available in the drivers also when software
nodes are used.
The implementation tries to mimic the "OF graph" as much as possible, but
there is no support for the "reg" device property. The ports will need to
have the index in their name which starts with "port@" (for example
"port@0", "port@1", ...) and endpoints will use the index of the software
node that is given to them during creation. The port nodes can also be
grouped under a specially named "ports" subnode, just like in DT, if
necessary.
The remote-endpoints are reference properties under the endpoint nodes
that are named "remote-endpoint".
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Co-developed-by: Daniel Scally <djrscally@gmail.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:30 +0000 (14:28 +0100)]
media: device property: Define format macros for ports and endpoints
OF, ACPI and software_nodes all implement graphs including nodes for ports
and endpoints. These are all intended to be named with a common schema,
as "port@n" and "endpoint@n" where n is an unsigned int representing the
index of the node. To ensure commonality across the subsystems, provide a
set of macros to define the format.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:29 +0000 (14:28 +0100)]
media: software_node: unregister software_nodes in reverse order
To maintain consistency with software_node_unregister_nodes(), reverse
the order in which the software_node_unregister_node_group() function
unregisters nodes.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:28 +0000 (14:28 +0100)]
media: software_node: Enforce parent before child ordering of nodes arrays
Registering software_nodes with the .parent member set to point to a
currently unregistered software_node has the potential for problems,
so enforce parent -> child ordering in arrays passed in to
software_node_register_nodes().
Software nodes that are children of another software node should be
unregistered before their parent. To allow easy unregistering of an array
of software_nodes ordered parent to child, reverse the order in which
software_node_unregister_nodes() unregisters software_nodes.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:27 +0000 (14:28 +0100)]
media: device property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary
This function is used to find fwnode endpoints against a device. In
some instances those endpoints are software nodes which are children of
fwnode->secondary. Add support to fwnode_graph_get_endpoint_by_id() to
find those endpoints by recursively calling itself passing the ptr to
fwnode->secondary in the event no endpoint is found for the primary.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Daniel Scally [Thu, 7 Jan 2021 13:28:26 +0000 (14:28 +0100)]
media: device property: Return true in fwnode_device_is_available for NULL ops
Some types of fwnode_handle do not implement the device_is_available()
check, such as those created by software_nodes. There isn't really a
meaningful way to check for the availability of a device that doesn't
actually exist, so if the check isn't implemented just assume that the
"device" is present.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Thu, 7 Jan 2021 13:28:25 +0000 (14:28 +0100)]
media: ipu3-cio2: Add headers that ipu3-cio2.h is direct user of
Add headers that ipu3-cio2.h is direct user of.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@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>
Daniel Scally [Thu, 7 Jan 2021 13:28:24 +0000 (14:28 +0100)]
media: software_node: Fix refcounts in software_node_get_next_child()
The software_node_get_next_child() function currently does not hold
references to the child software_node that it finds or put the ref that
is held against the old child - fix that.
Fixes:
59abd83672f7 ("drivers: base: Introducing software nodes to the firmware node framework")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Wed, 13 Jan 2021 08:34:41 +0000 (09:34 +0100)]
media: Documentation: media: Fix recently introduced build warning in subdev docs
A reference to the sub-device pad ops was not follwed by a whitespace,
resulting in a warning during documentation build. Fix it.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes:
25c8d9a7689e ("media: Documentation: v4l: Document that link_validate op is valid for sink only")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Paul Kocialkowski [Tue, 5 Jan 2021 14:47:19 +0000 (15:47 +0100)]
media: i2c: ov5648/ov8865: Minor cosmetic fixes
This solves a few minor cosmetic issues picked up by checkpatch for
the OV5648 and OV8865 drivers.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Rob Herring [Mon, 4 Jan 2021 16:58:08 +0000 (17:58 +0100)]
media: dt-bindings: media: Use graph and video-interfaces schemas
Now that we have graph and video-interfaces schemas, rework the media
related schemas to use them.
Cc: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Rob Herring [Mon, 4 Jan 2021 16:58:07 +0000 (17:58 +0100)]
media: dt-bindings: Convert video-interfaces.txt properties to schemas
Convert video-interfaces.txt to DT schema. As it contains a mixture of
device level and endpoint properties, split it up into 2 schemas.
Binding schemas will need to reference both the graph.yaml and
video-interfaces.yaml schemas. The exact schema depends on how many
ports and endpoints for the binding. A single port with a single
endpoint looks similar to this:
port:
$ref: /schemas/graph.yaml#/$defs/port-base
properties:
endpoint:
$ref: video-interfaces.yaml#
unevaluatedProperties: false
properties:
bus-width:
enum: [ 8, 10, 12, 16 ]
pclk-sample: true
hsync-active: true
vsync-active: true
required:
- bus-width
additionalProperties: false
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zheng Yongjun [Fri, 8 Jan 2021 09:21:35 +0000 (10:21 +0100)]
media: atomisp: convert comma to semicolon
Replace a comma between expression statements by a semicolon.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zheng Yongjun [Fri, 8 Jan 2021 09:21:19 +0000 (10:21 +0100)]
media: zoran: convert comma to semicolon
Replace a comma between expression statements by a semicolon.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Acked-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tomi Valkeinen [Wed, 13 Jan 2021 09:00:27 +0000 (10:00 +0100)]
media: ti-vpe: cal: fix write to unallocated memory
The asd allocated with v4l2_async_notifier_add_fwnode_subdev() must be
of size cal_v4l2_async_subdev, otherwise access to
cal_v4l2_async_subdev->phy will go to unallocated memory.
Fixes:
8fcb7576ad19 ("media: ti-vpe: cal: Allow multiple contexts per subdev notifier")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zou Wei [Tue, 12 Jan 2021 01:27:14 +0000 (02:27 +0100)]
media: ti-vpe: cal: Mark cal_camerarx_media_ops with static keyword
Fix the following sparse warning:
drivers/media/platform/ti-vpe/cal-camerarx.c:783:32: warning: symbol 'cal_camerarx_media_ops' was not declared. Should it be static?
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Rui Miguel Silva [Thu, 7 Jan 2021 10:47:26 +0000 (11:47 +0100)]
media: imx7: csi: Fix pad link validation
We can not make the assumption that the bound subdev is always a CSI
mux, in i.MX6UL/i.MX6ULL that is not the case. So, just get the entity
selected by source directly upstream from the CSI.
Fixes:
86e02d07871c ("media: imx5/6/7: csi: Mark a bound video mux as a CSI mux")
Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio Estevam [Thu, 7 Jan 2021 10:47:25 +0000 (11:47 +0100)]
media: imx7: csi: Fix regression for parallel cameras on i.MX6UL
Commit
86e02d07871c ("media: imx5/6/7: csi: Mark a bound video mux as
a CSI mux") made an incorrect assumption that for imx7-media-csi,
the bound subdev must always be a CSI mux. On i.MX6UL/i.MX6ULL there
is no CSI mux at all, so do not return an error when the entity is not a
video mux and assign the IMX_MEDIA_GRP_ID_CSI_MUX group id only when
appropriate.
This is the same approach as done in imx-media-csi.c and it fixes the
csi probe regression on i.MX6UL.
Tested on a imx6ull-evk board.
Fixes:
86e02d07871c ("media: imx5/6/7: csi: Mark a bound video mux as a CSI mux")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dikshita Agarwal [Mon, 4 Jan 2021 05:41:54 +0000 (06:41 +0100)]
media: venus: venc : Add support for priority ID control.
Add support for base layer priority ID control in encoder.
This is a preparation patch to support v6.
[hverkuil: changed 54 to 51 in v4l2_ctrl_handler_init]
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dikshita Agarwal [Mon, 4 Jan 2021 05:41:53 +0000 (06:41 +0100)]
media: v4l2-ctrl: Add base layer priority id control.
This control indicates the priority id to be applied
to base layer.
[hverkuil: renumbered V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID]
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dikshita Agarwal [Thu, 24 Dec 2020 11:25:35 +0000 (12:25 +0100)]
media: venus: venc: Add support for frame-specific min/max qp controls
Add support for frame type specific min and max qp controls
for encoder.
This is a preparation patch to support v6.
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dikshita Agarwal [Thu, 24 Dec 2020 11:25:34 +0000 (12:25 +0100)]
media: v4l2-ctrl: Add layer wise bitrate controls for h264
Adds bitrate control for all coding layers for h264
same as hevc.
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dikshita Agarwal [Thu, 24 Dec 2020 11:25:33 +0000 (12:25 +0100)]
media: v4l2-ctrl: Add frame-specific min/max qp controls for hevc
- Adds min/max qp controls for B frame for h264.
- Adds min/max qp controls for I/P/B frames for hevc similar to h264.
- Update valid range of min/max qp for hevc to accommodate 10 bit.
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Tue, 5 Jan 2021 17:12:28 +0000 (18:12 +0100)]
media: ccs: Make (non-)use of uninitialised variables more robust
GCC with W=2 level of kernel compiler warnings warns about the use of
uninitialised variables in a few locations. While these uninitialised
variables were not used in reality, this still produced compiler warnings.
Address this by assigning the variables to NULL and checking for NULL in
places it is not expected, returning -EIO in that case. This provides
at least some sanity checking at runtime as the compiler appears unable to
do that at compile time.
Reported-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-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>
Zheng Yongjun [Tue, 22 Dec 2020 13:32:14 +0000 (14:32 +0100)]
media: cxd2841er: use DIV_ROUND_UP to calculate timeout
Don't open-code DIV_ROUND_UP() kernel macro.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
James Reynolds [Tue, 22 Dec 2020 12:07:04 +0000 (13:07 +0100)]
media: mceusb: Fix potential out-of-bounds shift
When processing a MCE_RSP_GETPORTSTATUS command, the bit index to set in
ir->txports_cabled comes from response data, and isn't validated.
As ir->txports_cabled is a u8, nothing should be done if the bit index
is greater than 7.
Cc: stable@vger.kernel.org
Reported-by: syzbot+ec3b3128c576e109171d@syzkaller.appspotmail.com
Signed-off-by: James Reynolds <jr@memlen.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Sun, 27 Dec 2020 13:45:01 +0000 (14:45 +0100)]
media: ir_toy: add another IR Droid device
This device is also supported.
Cc: stable@vger.kernel.org
Tested-by: Georgi Bakalski <georgi.bakalski@gmail.com>
Reported-by: Georgi Bakalski <georgi.bakalski@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 12:44:15 +0000 (14:44 +0200)]
media: venus: helpers: Wire up hfi platform buffer requirements
Now when everything is in place wire up buffer requirements
from hfi platform buffers to the buffer requirements helper.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 12:42:52 +0000 (14:42 +0200)]
media: venus: vdec,core: Handle picture structure event
Handle progressive/interlaced bitstream event by similar way as
bit depth.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 12:39:13 +0000 (14:39 +0200)]
media: venus: Get codecs and capabilities from hfi platform
Wire up hfi platform codec and capabilities instead of
getting them from firmware.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 12:36:20 +0000 (14:36 +0200)]
media: venus: Add platform buffers for v6
Add a new file for hfi platform buffer size and count calculations
for v6.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 12:20:13 +0000 (14:20 +0200)]
media: venus: hfi_plat: Add hfi platform buffers ops
>From Venus v6 and beyond the buffer size and count have to be
calculated in the v4l2 driver instead of getting them from
firmware.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 11:40:10 +0000 (13:40 +0200)]
media: venus: hfi_plat_v6: Populate capabilities for v6
Add new hfi platform file with capabilities of hfi v6.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 11:35:47 +0000 (13:35 +0200)]
media: venus: hfi_plat: Add platform ops for getting number of VPP pipes
Starting from v6 we have one more hfi property which will be needed
to calculate buffer sizes/count for particular codec and session type.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 11:08:46 +0000 (13:08 +0200)]
media: venus: hfi_plat_v4: Populate codecs and capabilities for v4
Add new file for Venus hfi v4 with supported codecs and capabilities.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 11:07:07 +0000 (13:07 +0200)]
media: venus: hfi_plat: Add codecs and capabilities ops
Add ops to get the supported by the platform codecs and capabilities.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 26 Aug 2020 11:04:09 +0000 (13:04 +0200)]
media: venus: Rename venus_caps to hfi_plat_caps
Now when we have hfi platform make venus capabilities an
hfi platform capabilities.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 5 Aug 2020 07:36:06 +0000 (09:36 +0200)]
media: venus: Create hfi platform and move vpp/vsp there
Introduce a new hfi platform to cover differences between hfi
versions. As a start move vpp/vsp freq data in that hfi
platform, more platform data will come later.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 29 Jul 2020 13:17:05 +0000 (15:17 +0200)]
media: venus: Add more capabilities and VP9 profile/levels
Add more caps and VP9 definitions for newer Venus versions.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Mon, 17 Aug 2020 14:28:20 +0000 (16:28 +0200)]
media: venus: Delete not used core caps
The core caps are filled but not used, delete them. In case we
need them we can re-introduce.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 11 Nov 2020 14:37:52 +0000 (15:37 +0100)]
media: venus: pm_helpers: Check instance state when calculate instance frequency
Skip calculating instance frequency if it is not in running state.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Wed, 11 Nov 2020 14:37:51 +0000 (15:37 +0100)]
media: venus: helpers: Calculate properly compressed buffer size
For resolutions below 720p the size of the compressed buffer must
be bigger. Correct this by checking the resolution when calculating
buffer size and multiply by eight.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Fri, 4 Dec 2020 10:01:39 +0000 (11:01 +0100)]
media: venus: hfi: Correct session init return error
The hfi_session_init can be called many times and it returns
EINVAL when the session was already initialized. This error code
(EINVAL) is confusing for the callers. Change hfi_session_init to
return EALREADY error code when the session has been already
initialized.
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Vikash Garodia [Fri, 4 Dec 2020 10:01:38 +0000 (11:01 +0100)]
media: venus: request for interrupt from venus
For synchronous commands, update the message queue variable.
This would inform video firmware to raise interrupt on host
CPU whenever there is a response for such commands.
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Fri, 4 Dec 2020 10:01:37 +0000 (11:01 +0100)]
media: venus: Limit HFI sessions to the maximum supported
Currently we rely on firmware to return error when we reach the maximum
supported number of sessions. But this errors are happened at reqbuf
time which is a bit later. The more reasonable way looks like is to
return the error on driver open.
To achieve that modify hfi_session_create to return error when we reach
maximum count of sessions and thus refuse open.
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Fri, 4 Dec 2020 10:01:36 +0000 (11:01 +0100)]
media: venus: venc: Init the session only once in queue_setup
Init the hfi session only once in queue_setup and also cover that
with inst->lock.
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fritz Koenig [Tue, 1 Dec 2020 04:23:23 +0000 (05:23 +0100)]
media: venus: vdec: Handle DRC after drain
If the DRC is near the end of the stream the client
may send a V4L2_DEC_CMD_STOP before the DRC occurs.
V4L2_DEC_CMD_STOP puts the driver into the
VENUS_DEC_STATE_DRAIN state. DRC must be aware so
that after the DRC event the state can be restored
correctly.
Signed-off-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Alexandre Courbot [Wed, 2 Dec 2020 05:34:24 +0000 (06:34 +0100)]
media: venus: preserve DRC state across seeks
DRC events can happen virtually at anytime, including when we are
starting a seek. Should this happen, we must make sure to return to the
DRC state, otherwise the firmware will expect buffers of the new
resolution whereas userspace will still work with the old one.
Returning to the DRC state upon resume for seeking makes sure that the
client will get the DRC event and will reallocate the buffers to fit the
firmware's expectations.
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Mon, 28 Sep 2020 16:44:31 +0000 (18:44 +0200)]
media: venus: helpers: Lock outside of buffer queue helper
After adding more logic in vdec buf_queue vb2 op it is not
practical to have two lock/unlock for one decoder buf_queue.
So move the instance lock in encoder and decoder vb2 buf_queue
operations.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Mon, 28 Sep 2020 16:44:30 +0000 (18:44 +0200)]
media: venus: vdec: Make decoder return LAST flag for sufficient event
This makes the decoder to behaives equally for sufficient and
insufficient events. After this change the LAST buffer flag will be set
when the new resolution (in dynamic-resolution-change state) is smaller
then the old bitstream resolution.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stanimir Varbanov [Mon, 28 Sep 2020 16:44:29 +0000 (18:44 +0200)]
media: venus: vdec: Fix non reliable setting of LAST flag
In real use of dynamic-resolution-change it is observed that the
LAST buffer flag (which marks the last decoded buffer with the
resolution before the resolution-change event) is not reliably set.
Fix this by set the LAST buffer flag on next queued capture buffer
after the resolution-change event.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Alexandre Courbot [Mon, 14 Dec 2020 12:57:03 +0000 (13:57 +0100)]
media: venus: use contig vb2 ops
This driver uses the SG vb2 ops, but effectively only ever accesses the
first entry of the SG table, indicating that it expects a flat layout.
Switch it to use the contiguous ops to make sure this expected invariant
is always enforced. Since the device is supposed to be behind an IOMMU
this should have little to none practical consequences beyond making the
driver not rely on a particular behavior of the SG implementation.
Reported-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zhang Changzhong [Fri, 4 Dec 2020 08:27:58 +0000 (09:27 +0100)]
media: aspeed: fix error return code in aspeed_video_setup_video()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Fixes:
d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Matwey V. Kornilov [Mon, 4 Jan 2021 17:00:07 +0000 (18:00 +0100)]
media: pwc: Use correct device for DMA
This fixes the following newly introduced warning:
[ 15.518253] ------------[ cut here ]------------
[ 15.518941] WARNING: CPU: 0 PID: 246 at kernel/dma/mapping.c:149 dma_map_page_attrs+0x1a8/0x1d0
[ 15.520634] Modules linked in: pwc videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc efivarfs
[ 15.522335] CPU: 0 PID: 246 Comm: v4l2-test Not tainted 5.11.0-rc1+ #1
[ 15.523281] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
[ 15.524438] RIP: 0010:dma_map_page_attrs+0x1a8/0x1d0
[ 15.525135] Code: 10 5b 5d 41 5c 41 5d c3 4d 89 d0 eb d7 4d 89 c8 89 e9 48 89 da e8 68 29 00 00 eb d1 48 89 f2 48 2b 50 18 48 89 d0 eb 83 0f 0b <0f> 0b 48 c7 c0 ff ff ff ff eb b8 48 89 d9 48 8b 40 40 e8 61 69 d2
[ 15.527938] RSP: 0018:
ffffa2694047bca8 EFLAGS:
00010246
[ 15.528716] RAX:
0000000000000000 RBX:
0000000000002580 RCX:
0000000000000000
[ 15.529782] RDX:
0000000000000000 RSI:
ffffcdce000ecc00 RDI:
ffffa0b4bdb888a0
[ 15.530849] RBP:
0000000000000002 R08:
0000000000000002 R09:
0000000000000000
[ 15.531881] R10:
0000000000000004 R11:
000000000002d8c0 R12:
0000000000000000
[ 15.532911] R13:
ffffa0b4bdb88800 R14:
ffffa0b483820000 R15:
ffffa0b4bdb888a0
[ 15.533942] FS:
00007fc5fbb5e4c0(0000) GS:
ffffa0b4fc000000(0000) knlGS:
0000000000000000
[ 15.535141] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 15.535988] CR2:
00007fc5fb6ea138 CR3:
0000000003812000 CR4:
00000000001506f0
[ 15.537025] Call Trace:
[ 15.537425] start_streaming+0x2e9/0x4b0 [pwc]
[ 15.538143] vb2_start_streaming+0x5e/0x110 [videobuf2_common]
[ 15.538989] vb2_core_streamon+0x107/0x140 [videobuf2_common]
[ 15.539831] __video_do_ioctl+0x18f/0x4a0 [videodev]
[ 15.540670] video_usercopy+0x13a/0x5b0 [videodev]
[ 15.541349] ? video_put_user+0x230/0x230 [videodev]
[ 15.542096] ? selinux_file_ioctl+0x143/0x200
[ 15.542752] v4l2_ioctl+0x40/0x50 [videodev]
[ 15.543360] __x64_sys_ioctl+0x89/0xc0
[ 15.543930] do_syscall_64+0x33/0x40
[ 15.544448] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 15.545236] RIP: 0033:0x7fc5fb671587
[ 15.545780] Code: b3 66 90 48 8b 05 11 49 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 48 2c 00 f7 d8 64 89 01 48
[ 15.548486] RSP: 002b:
00007fff0f71f038 EFLAGS:
00000246 ORIG_RAX:
0000000000000010
[ 15.549578] RAX:
ffffffffffffffda RBX:
0000000000000003 RCX:
00007fc5fb671587
[ 15.550664] RDX:
00007fff0f71f060 RSI:
0000000040045612 RDI:
0000000000000003
[ 15.551706] RBP:
0000000000000000 R08:
0000000000000000 R09:
0000000000000000
[ 15.552738] R10:
0000000000000000 R11:
0000000000000246 R12:
00007fff0f71f060
[ 15.553817] R13:
00007fff0f71f1d0 R14:
0000000000de1270 R15:
0000000000000000
[ 15.554914] ---[ end trace
7be03122966c2486 ]---
Fixes:
1161db6776bd ("media: usb: pwc: Don't use coherent DMA buffers for ISO transfer")
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dinghao Liu [Sat, 2 Jan 2021 08:26:37 +0000 (09:26 +0100)]
media: tm6000: Fix memleak in tm6000_start_stream
When usb_clear_halt() fails, dvb->bulk_urb->transfer_buffer
and dvb->bulk_urb should be freed just like when
usb_submit_urb() fails.
Fixes:
3169c9b26fffa ("V4L/DVB (12788): tm6000: Add initial DVB-T support")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dinghao Liu [Sat, 2 Jan 2021 06:27:22 +0000 (07:27 +0100)]
media: media/pci: Fix memleak in empress_init
When vb2_queue_init() fails, dev->empress_dev
should be released just like other error handling
paths.
Fixes:
2ada815fc48bb ("[media] saa7134: convert to vb2")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Zheng Yongjun [Mon, 28 Dec 2020 13:51:04 +0000 (14:51 +0100)]
media: platform: davinci: Use DEFINE_SPINLOCK() for spinlock
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dinghao Liu [Mon, 28 Dec 2020 13:02:05 +0000 (14:02 +0100)]
media: em28xx: Fix use-after-free in em28xx_alloc_urbs
When kzalloc() fails, em28xx_uninit_usb_xfer() will free
usb_bufs->buf and set it to NULL. Thus the later access
to usb_bufs->buf[i] will lead to null pointer dereference.
Also the kfree(usb_bufs->buf) after that is redundant.
Fixes:
d571b592c6206 ("media: em28xx: don't use coherent buffer for DMA transfers")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Nigel Christian [Fri, 18 Dec 2020 06:31:17 +0000 (07:31 +0100)]
media: cec: fix trivial style warnings
Comment has 'then' repeated twice. Let's clean it up.
Use unsigned int to maintain naming consistency.
Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Kieran Bingham [Wed, 16 Dec 2020 11:45:48 +0000 (12:45 +0100)]
media: vsp1: Use BIT macro for feature identification
These entries can only ever be single bits. Make use of the BIT macro
accordingly.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Sat, 12 Dec 2020 17:41:19 +0000 (18:41 +0100)]
media: vsp1: Fix an error handling path in the probe function
A previous 'rcar_fcp_get()' call must be undone in the error handling path,
as already done in the remove function.
Fixes:
94fcdf829793 ("[media] v4l: vsp1: Add FCP support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sebastian Fricke [Sat, 12 Dec 2020 18:53:06 +0000 (19:53 +0100)]
media: rkisp1: isp: Add the enum_frame_size ioctl
Implement the VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl for the isp entity,
check if the mbus code is valid for the given pad.
This call is not available for the parameter or metadata pads of the
RkISP1.
Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
Acked-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-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>
Geert Uytterhoeven [Fri, 11 Dec 2020 13:38:06 +0000 (14:38 +0100)]
media: sh_vou: Drop bogus __refdata annotation
Since commit
4c62e9764ab403d4 ("Drivers: media: remove __dev*
attributes.") in v3.8, the SuperH Video Output Unit driver no longer has
any code or data located in initmem, hence there is no need to annotate
the sh_vou structure with __refdata. Drop the annotation, to avoid
suppressing future section warnings.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Lukas Bulwahn [Wed, 9 Dec 2020 07:46:58 +0000 (08:46 +0100)]
media: MAINTAINERS: correct entry in Amlogic GE2D driver section
Commit
aa821b2b9269 ("media: MAINTAINERS: Add myself as maintainer of the
Amlogic GE2D driver") introduced a new MAINTAINERS section, but the file
entry points to the wrong location.
Hence, ./scripts/get_maintainer.pl --self-test=patterns warns:
warning: no file matches F: drivers/media/meson/ge2d/
Adjust the entry to the actual location of the driver.
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Wed, 9 Dec 2020 06:51:30 +0000 (07:51 +0100)]
media: camss: missing error code in msm_video_register()
This error path returns success but it should return -EINVAL.
Fixes:
cba3819d1e93 ("media: camss: Format configuration per hardware version")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Wed, 9 Dec 2020 06:50:34 +0000 (07:50 +0100)]
media: camss: Fix signedness bug in video_enum_fmt()
This test has a problem because we want to know if "k" is -1 or a
positive value less than "f->index". But the "f->index" variable is a
u32 so if "k == -1" then -1 gets type promoted to UINT_MAX which is
larger than "f->index". I've added an explicit test to check for -1.
Fixes:
a3d412d4b9f3 ("media: Revert "media: camss: Make use of V4L2_CAP_IO_MC"")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Travis Carter [Fri, 4 Dec 2020 23:37:43 +0000 (00:37 +0100)]
media: staging:rkvdec: Fixed "replace comma with semicolon" Warning
Corrected the following Warning:
drivers/staging/media/rkvdec/rkvdec.c:133: WARNING: Possible comma where semicolon could be used
Signed-off-by: Travis Carter <traviscarter2@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Travis Carter [Fri, 4 Dec 2020 23:51:50 +0000 (00:51 +0100)]
media: staging:hantro: Fixed "replace comma with semicolon" Warning
Corrected the following Warning:
drivers/staging/media/hantro/hantro_v4l2.c:319: WARNING: Possible comma where semicolon could be used
Signed-off-by: Travis Carter <traviscarter2@gmail.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>
Zhang Changzhong [Fri, 4 Dec 2020 08:29:34 +0000 (09:29 +0100)]
media: mtk-vcodec: fix error return code in vdec_vp9_decode()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Fixes:
dea42fb79f4f ("media: mtk-vcodec: reset segment data then trig decoder")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.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:07:30 +0000 (00:07 +0100)]
media: ti-vpe: cal: avoid FIELD_GET assertion
FIELD_GET() must only be used with a mask that is a compile-time
constant:
drivers/media/platform/ti-vpe/cal.h: In function 'cal_read_field':
include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_247' declared with attribute error: FIELD_GET: mask is not constant
include/linux/bitfield.h:46:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
46 | BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
| ^~~~~~~~~~~~~~~~
drivers/media/platform/ti-vpe/cal.h:220:9: note: in expansion of macro 'FIELD_GET'
220 | return FIELD_GET(mask, cal_read(cal, offset));
| ^~~~~~~~~
The problem here is that the function is not always inlined. Mark it
__always_inline to avoid the problem.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Enrico Weigelt [Thu, 3 Dec 2020 12:47:57 +0000 (13:47 +0100)]
media: drivers: staging: media: remove unneeded MODULE_VERSION() call
Remove MODULE_VERSION(), as it doesn't seem to serve any practical purpose.
For in-tree drivers, the kernel version matters. The code received lots of
changes, but module version remained constant, since the driver landed in
mainline. So, this version doesn't seem have any practical meaning anymore.
Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 4 Jan 2021 20:34:41 +0000 (21:34 +0100)]
media: imx: Clean capture unregister
No locking is needed to call video_unregister_device(). Drop it.
Also, drop the superfluous video_is_registered() call, which is
done by video_unregister_device(), and re-order media_entity_cleanup()
and video_unregister_device() calls.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.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>
Ezequiel Garcia [Mon, 4 Jan 2021 20:34:40 +0000 (21:34 +0100)]
media: imx: Fix csc/scaler unregister
The csc/scaler device private struct is released by
ipu_csc_scaler_video_device_release(), which can be called
by video_unregister_device() if there are no users
of the underlying struct video device.
Therefore, the mutex can't be held when calling
video_unregister_device() as its memory may be freed
by it, leading to a kernel oops.
Fortunately, the fix is quite simple as no locking
is needed when calling video_unregister_device(): v4l2-core
already has its own internal locking, and the structures
are also properly refcounted.
Fixes:
a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.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>
Ezequiel Garcia [Mon, 4 Jan 2021 20:34:39 +0000 (21:34 +0100)]
media: imx: Unregister csc/scaler only if registered
The csc/scaler device pointer (imxmd->m2m_vdev) is assigned
after the imx media device v4l2-async probe completes,
therefore we need to check if the device is non-NULL
before trying to unregister it.
This can be the case if the non-completed imx media device
is unbinded (or the driver is removed), leading to a kernel oops.
Fixes:
a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.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>
Martin Kepplinger [Wed, 2 Dec 2020 13:12:51 +0000 (14:12 +0100)]
media: staging: media: imx: Kconfig: support VIDEO_IMX7_CSI for imx8m
As described in NXPs' linux tree, the imx8m SoC includes the same
CSI bridge hardware that is part of imx7d. We should be able to
use the "fsl,imx7-csi" driver for imx8m directly.
Since ipuv3 is not relevant for imx8m, move that dependency to
VIDEO_IMX_CSI. That makes VIDEO_IMX7_CSI available to support imx8m
too.
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Fri, 11 Dec 2020 11:30:09 +0000 (12:30 +0100)]
media: ccs: Small definition cleanup
struct device is used in ccs-data.h but no definition is included. Add a
forward definition.
Also ccs-data.c includes linux/types.h but this is already included in
ccs-data.h which ccs-data.c includes. Do don't include linux/types.h in
ccs-data.c.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Mon, 7 Dec 2020 16:34:57 +0000 (17:34 +0100)]
media: Revert "media: ccs-pll: Fix MODULE_LICENSE"
This reverts commit
b3c0115e34adcabe12fce8845e24ca6f04c1554e.
As per Documentation/process/license-rules.rst "GPL v2" exists only for
historical reasons and has the same meaning as "GPL". So revert this
patch.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 26 Nov 2020 20:02:54 +0000 (21:02 +0100)]
media: ccs: Switch from standard integer types to kernel ones
The preferred integer types in the kernel are the Linux specific ones,
switch from standard C types to u32 and alike.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 26 Nov 2020 20:01:54 +0000 (21:01 +0100)]
media: ccs-pll: Switch from standard integer types to kernel ones
The preferred integer types in the kernel are the Linux specific ones,
switch from standard C types to u32 and alike.
The patch has been produced with the following Coccinelle spatch, with few
alignment adjustments:
@@
typedef uint32_t;
typedef u32;
@@
- uint32_t
+ u32
@@
typedef uint16_t;
typedef u16;
@@
- uint16_t
+ u16
@@
typedef uint8_t;
typedef u8;
@@
- uint8_t
+ u8
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Mon, 16 Nov 2020 17:25:12 +0000 (18:25 +0100)]
media: Documentation: Include CCS PLL calculator to CCS driver documentation
Include existing CCS PLL calculator kerneldoc documentation to the
documentation build.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Fri, 9 Oct 2020 10:57:06 +0000 (12:57 +0200)]
media: ccs: Support and default to auto PHY control
CCS supports three variants of PHY timing control, auto, UI based and
manual. The driver previously assumed UI based control that requires
updating the link rate to the sensor. Now default to automatic control
instead, and only write the link rate to the sensor in UI mode.
If neither auto or UI control is supported, return an error in probe.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 8 Oct 2020 16:43:56 +0000 (18:43 +0200)]
media: ccs: Add a sanity check for external clock frequency
The driver depends on the external clock frequency. Add a sanity check for
the frequency, by returning an error from probe if it's zero.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 8 Oct 2020 16:24:39 +0000 (18:24 +0200)]
media: ccs: Hardware requires a delay after starting the clock of lifting reset
A CCS compliant device requires a delay before the first I²C transaction
after pulling xshutdown up or starting the external clock. This is what
the driver does. However, if neither is actually there, there's no need
for the delay.
This also has the effect of removing an unnecessary delay on ACPI systems
where ACPI is responsible for the power-up sequence.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 8 Oct 2020 10:09:07 +0000 (12:09 +0200)]
media: ccs: Wait until software reset is done
Verify the software reset has been completed until proceeding.
The spec does not guarantee a delay but presumably 100 ms should be
enough.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sakari Ailus [Thu, 8 Oct 2020 08:59:26 +0000 (10:59 +0200)]
media: ccs: Only do software reset if we have no hardware reset
The driver always used software reset after the sensor's power sequence
that includes a hardware reset if we have a reset GPIO. Do not use
software reset if we just brought the sensor up from hardware reset state.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>