Zhen Lei [Thu, 3 Jun 2021 07:12:49 +0000 (09:12 +0200)]
media: mc-device.c: use DEVICE_ATTR_RO() helper macro
Use DEVICE_ATTR_RO() helper macro instead of DEVICE_ATTR(), which is
simpler and more readable.
Due to the name of the read function of the sysfs attribute is normalized,
there is a natural association.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Xavier Roumegue [Fri, 18 Jun 2021 07:59:33 +0000 (09:59 +0200)]
media: ov5640: Complement yuv mbus formats with their 1X16 versions
According to media bus pixel codes definition, data formats on serial
busses should be described with one bus sample per pixel.
Documentation/userspace-api/media/v4l/subdev-formats.rst states:
"The media bus pixel codes document parallel formats. Should the pixel
data be transported over a serial bus, the media bus pixel code that
describes a parallel format that transfers a sample on a single clock
cycle is used. For instance, both MEDIA_BUS_FMT_BGR888_1X24 and
MEDIA_BUS_FMT_BGR888_3X8 are used on parallel busses for transferring an
8 bits per sample BGR data, whereas on serial busses the data in this
format is only referred to using MEDIA_BUS_FMT_BGR888_1X24. This is
because there is effectively only a single way to transport that
format on the serial busses."
Some MIPI CSI receivers strictly obey this definition and declare
support for only *1X_* formats.
Hence, complement the supported media bus formats with their 1X16 versions
(currently applicable to yuyv, uyvy) to enhance interoperability with CSI
receivers.
Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martina Krasteva [Thu, 27 May 2021 14:21:45 +0000 (16:21 +0200)]
media: i2c: Add ov9282 camera sensor driver
Add a v4l2 sub-device driver for the OmniVisison ov9282
black&white image sensor.
The camera sensor uses the i2c bus for control and the
csi-2 bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 1280x720 @ 30fps
[Sakari Ailus: Rebase on commit
c802a4174beeb25cb539c806c9d0d3c0f61dfa53.]
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martina Krasteva [Thu, 27 May 2021 14:21:44 +0000 (16:21 +0200)]
media: dt-bindings: media: Add bindings for ov9282
- Add dt-bindings documentation for OmniVision ov9282 sensor driver
- Add MAINTAINERS entry for OmniVision ov9282 binding documentation
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.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>
Martina Krasteva [Thu, 27 May 2021 14:21:43 +0000 (16:21 +0200)]
media: i2c: Add imx412 camera sensor driver
Add a v4l2 sub-device driver for the Sony imx412 image sensor.
This is a camera sensor using the i2c bus for control and the
csi-2 bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 4056x3040 @ 30fps
- supported bayer order output:
- SRGGB10
[Sakari Ailus: Rebase on commit
c802a4174beeb25cb539c806c9d0d3c0f61dfa53.]
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martina Krasteva [Thu, 27 May 2021 14:21:42 +0000 (16:21 +0200)]
media: dt-bindings: media: Add bindings for imx412
- Add dt-bindings documentation for Sony imx412 sensor driver
- Add MAINTAINERS entry for Sony imx412 binding documentation
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.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>
Martina Krasteva [Thu, 27 May 2021 14:21:41 +0000 (16:21 +0200)]
media: i2c: Add imx335 camera sensor driver
Add a v4l2 sub-device driver for the Sony imx335 image sensor.
ThE camera sensor uses the i2c bus for control and the csi-2
bus for data.
The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 2592x1940 @ 30fps
- supported bayer order output:
- SRGGB12
[Sakari Ailus: Rebase on commit
c802a4174beeb25cb539c806c9d0d3c0f61dfa53.]
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martina Krasteva [Thu, 27 May 2021 14:21:40 +0000 (16:21 +0200)]
media: dt-bindings: media: Add bindings for imx335
- Add dt-bindings documentation for Sony imx335 sensor driver
- Add MAINTAINERS entry for Sony imx335 binding documentation
Signed-off-by: Martina Krasteva <martinax.krasteva@intel.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Acked-by: Paul J. Murphy <paul.j.murphy@intel.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>
Paul Kocialkowski [Wed, 9 Jun 2021 11:54:56 +0000 (13:54 +0200)]
media: v4l2-subdev: Fix documentation of the subdev_notifier member
Fix the name of the function that registers the subdev_notifier member
of the v4l2_subdev structure.
[Sakari Ailus: Drop _sensor from the function name.]
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>
Dongliang Mu [Wed, 7 Jul 2021 09:34:09 +0000 (11:34 +0200)]
media: em28xx-input: fix refcount bug in em28xx_usb_disconnect
If em28xx_ir_init fails, it would decrease the refcount of dev. However,
in the em28xx_ir_fini, when ir is NULL, it goes to ref_put and decrease
the refcount of dev. This will lead to a refcount bug.
Fix this bug by removing the kref_put in the error handling code
of em28xx_ir_init.
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 7 at lib/refcount.c:28 refcount_warn_saturate+0x18e/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 7 Comm: kworker/0:1 Not tainted 5.13.0 #3
Workqueue: usb_hub_wq hub_event
RIP: 0010:refcount_warn_saturate+0x18e/0x1a0 lib/refcount.c:28
Call Trace:
kref_put.constprop.0+0x60/0x85 include/linux/kref.h:69
em28xx_usb_disconnect.cold+0xd7/0xdc drivers/media/usb/em28xx/em28xx-cards.c:4150
usb_unbind_interface+0xbf/0x3a0 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1201 [inline]
device_release_driver_internal+0x22a/0x230 drivers/base/dd.c:1232
bus_remove_device+0x108/0x160 drivers/base/bus.c:529
device_del+0x1fe/0x510 drivers/base/core.c:3540
usb_disable_device+0xd1/0x1d0 drivers/usb/core/message.c:1419
usb_disconnect+0x109/0x330 drivers/usb/core/hub.c:2221
hub_port_connect drivers/usb/core/hub.c:5151 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5440 [inline]
port_event drivers/usb/core/hub.c:5586 [inline]
hub_event+0xf81/0x1d40 drivers/usb/core/hub.c:5668
process_one_work+0x2c9/0x610 kernel/workqueue.c:2276
process_scheduled_works kernel/workqueue.c:2338 [inline]
worker_thread+0x333/0x5b0 kernel/workqueue.c:2424
kthread+0x188/0x1d0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Fixes:
ac5688637144 ("media: em28xx: Fix possible memory leak of em28xx struct")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Viktor Prutyanov [Mon, 19 Jul 2021 17:05:06 +0000 (19:05 +0200)]
media: rc: introduce Meson IR TX driver
This patch adds the driver for Amlogic Meson IR transmitter.
Some Amlogic SoCs such as A311D and T950D4 have IR transmitter
(also called blaster) controller onboard. It is capable of sending
IR signals with arbitrary carrier frequency and duty cycle.
The driver supports 2 modulation clock sources:
- xtal3 clock (xtal divided by 3)
- 1us clock
Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Viktor Prutyanov [Mon, 19 Jul 2021 17:05:05 +0000 (19:05 +0200)]
media: rc: meson-ir-tx: document device tree bindings
This patch adds binding documentation for the IR transmitter
available in Amlogic Meson SoCs.
Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Tue, 3 Aug 2021 13:36:58 +0000 (15:36 +0200)]
Merge commit '
c3cdc019a6bf' into media_tree
* commit '
c3cdc019a6bf':
media: atomisp: pci: reposition braces as per coding style
media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
media: atomisp: Move MIPI_PORT_LANES to the only user
media: atomisp: Perform a single memset() for union
media: atomisp: pci: fix error return code in atomisp_pci_probe()
media: atomisp: pci: Remove unnecessary (void *) cast
media: atomisp: pci: Remove checks before kfree/kvfree
media: atomisp: Remove unused port_enabled variable
media: atomisp: Annotate a couple of definitions with __maybe_unused
media: atomisp: Remove unused declarations
media: atomisp: remove the repeated declaration
media: atomisp: improve error handling in gc2235_detect()
media: atomisp: Fix whitespace at the beginning of line
media: atomisp: Align block comments
media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
media: atomisp: Fix line continuation style issue in sh_css.c
media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
media: atomisp: Remove unnecessary parens in sh_css.c
media: atomisp: Resolve goto style issue in sh_css.c
media: atomisp: fix the uninitialized use and rename "retvalue"
Deepak R Varma [Fri, 30 Apr 2021 15:40:12 +0000 (17:40 +0200)]
media: atomisp: pci: reposition braces as per coding style
Misplaced braces makes it difficult to follow the code easily. This also
goes against the code style guidelines. This resolved following checkpatch
complaints:
ERROR: open brace '{' following function definitions go on the next line
ERROR: that open brace { should be on the previous line
Link: https://lore.kernel.org/linux-media/YIwk3KbVGRPJwKa4@dU2104
[mchehab: dropped a hunk with a merge conflict]
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, drv@mailo.com # X-LSpam-Score: -7.3 (-------)
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Mon, 19 Jul 2021 05:52:16 +0000 (07:52 +0200)]
media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
Remove a superfluous clause in mt9m114_s_power()
Link: https://lore.kernel.org/linux-media/20210719055216.28508-1-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Tue, 13 Jul 2021 15:25:22 +0000 (17:25 +0200)]
media: atomisp: Move MIPI_PORT_LANES to the only user
Move MIPI_PORT_LANES to the only user of it, i.e. pci/runtime/isys/src/rx.c.
Link: https://lore.kernel.org/linux-media/20210713152523.19902-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Kees Cook [Sun, 11 Jul 2021 14:51:01 +0000 (16:51 +0200)]
media: atomisp: Perform a single memset() for union
There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:
In function 'fortify_memset_chk',
inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field();
| ^~~~~~~~~~~~~~~~~~~~~~~~
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419
Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Yang Yingliang [Thu, 17 Jun 2021 07:23:29 +0000 (09:23 +0200)]
media: atomisp: pci: fix error return code in atomisp_pci_probe()
If init_atomisp_wdts() fails, atomisp_pci_probe() need return
error code.
Link: https://lore.kernel.org/linux-media/20210617072329.1233662-1-yangyingliang@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio M. De Francesco [Sat, 5 Jun 2021 02:08:55 +0000 (04:08 +0200)]
media: atomisp: pci: Remove unnecessary (void *) cast
Removed an unnecessary (void *) cast for an argument passed to kfree().
Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio M. De Francesco [Thu, 27 May 2021 19:39:22 +0000 (21:39 +0200)]
media: atomisp: pci: Remove checks before kfree/kvfree
Removed checks for pointers != NULL before freeing memory. If kvfree()
and kfree() are given NULL pointers no operations are performed, so
there is no need for the above-mentioned checks. Coccinelle detected the
second of the two unnecessary checks.
Link: https://lore.kernel.org/linux-media/20210527193922.25225-1-fmdefrancesco@gmail.com
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:22 +0000 (14:43 +0200)]
media: atomisp: Remove unused port_enabled variable
Remove unused port_enabled variable in ia_css_isys_rx_configure().
Link: https://lore.kernel.org/linux-media/20210526124322.48915-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:20 +0000 (14:43 +0200)]
media: atomisp: Annotate a couple of definitions with __maybe_unused
There are definitions in the header that are not used by all modules inside
the driver. Annotate them with __maybe_unused to avoid compiler warnings.
Link: https://lore.kernel.org/linux-media/20210526124322.48915-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:19 +0000 (14:43 +0200)]
media: atomisp: Remove unused declarations
There is a few static declarations that are not used anywhere, remove them.
Link: https://lore.kernel.org/linux-media/20210526124322.48915-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Shaokun Zhang [Tue, 25 May 2021 06:02:39 +0000 (08:02 +0200)]
media: atomisp: remove the repeated declaration
Function 'ia_css_mmu_invalidate_cache' is declared twice, remove the
repeated declaration.
Link: https://lore.kernel.org/linux-media/1621922559-1859-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tom Rix [Fri, 21 May 2021 19:48:05 +0000 (21:48 +0200)]
media: atomisp: improve error handling in gc2235_detect()
Static analysis reports this representative problem
atomisp-gc2235.c:867:20: warning: The right operand
of '|' is a garbage value
id = ((high << 8) | low);
^ ~~~
When gc2235_read_reg() fails, its return val is never written.
For gc2235_detect(), high and low are or-ed and compared
with GC2235_ID, 0x2235. Initialize both to 0 and skip
checking the read returns, it's errors are not passed up, only
-ENODEV is.
Link: https://lore.kernel.org/linux-media/20210521194805.2078135-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Aniket Bhattacharyea [Mon, 24 May 2021 17:36:09 +0000 (19:36 +0200)]
media: atomisp: Fix whitespace at the beginning of line
This patch fixes whitespace at the beginning of line by wrapping after
the type name and aligning the arguments with the open parenthesis.
Identified by checkpatch: WARNING: please, no spaces at the start of a
line.
Link: https://lore.kernel.org/linux-media/20210524173609.672153-1-aniketmail669@gmail.com
Signed-off-by: Aniket Bhattacharyea <aniketmail669@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jiabing Wan [Tue, 18 May 2021 11:29:35 +0000 (13:29 +0200)]
media: atomisp: Align block comments
Fixing the following checkpatch warning:
WARNING: Block comments should align the * on each line
Link: https://lore.kernel.org/linux-media/20210518112938.88240-1-wanjiabing@vivo.com
Signed-off-by: Jiabing Wan <kael_w@yeah.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Nguyen Dinh Phi [Thu, 13 May 2021 03:46:50 +0000 (05:46 +0200)]
media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.
Link: https://lore.kernel.org/linux-media/20210513034650.252993-1-phind.uet@gmail.com
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:22 +0000 (01:56 +0200)]
media: atomisp: Fix line continuation style issue in sh_css.c
Fix logical continuation style issue and adjacent line splits.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-5-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:21 +0000 (01:56 +0200)]
media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
Use kcalloc instead of kzalloc with multiplication.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-4-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:20 +0000 (01:56 +0200)]
media: atomisp: Remove unnecessary parens in sh_css.c
Remove unnecessary parenthesis.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:19 +0000 (01:56 +0200)]
media: atomisp: Resolve goto style issue in sh_css.c
Change the goto label to lower case.
Remove a space in the goto label.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-2-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Yizhuo [Fri, 25 Jun 2021 05:38:56 +0000 (07:38 +0200)]
media: atomisp: fix the uninitialized use and rename "retvalue"
Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.
The local variable "retvalue" is renamed to "model" to avoid
confusion.
Link: https://lore.kernel.org/linux-media/20210625053858.3862-1-yzhai003@ucr.edu
Fixes:
ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Deepak R Varma [Fri, 30 Apr 2021 15:40:12 +0000 (17:40 +0200)]
media: atomisp: pci: reposition braces as per coding style
Misplaced braces makes it difficult to follow the code easily. This also
goes against the code style guidelines. This resolved following checkpatch
complaints:
ERROR: open brace '{' following function definitions go on the next line
ERROR: that open brace { should be on the previous line
Link: https://lore.kernel.org/linux-media/YIwk3KbVGRPJwKa4@dU2104
[mchehab: dropped a hunk with a merge conflict]
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, drv@mailo.com # X-LSpam-Score: -7.3 (-------)
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Mon, 19 Jul 2021 05:52:16 +0000 (07:52 +0200)]
media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
Remove a superfluous clause in mt9m114_s_power()
Link: https://lore.kernel.org/linux-media/20210719055216.28508-1-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Tue, 13 Jul 2021 15:25:22 +0000 (17:25 +0200)]
media: atomisp: Move MIPI_PORT_LANES to the only user
Move MIPI_PORT_LANES to the only user of it, i.e. pci/runtime/isys/src/rx.c.
Link: https://lore.kernel.org/linux-media/20210713152523.19902-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Kees Cook [Sun, 11 Jul 2021 14:51:01 +0000 (16:51 +0200)]
media: atomisp: Perform a single memset() for union
There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:
In function 'fortify_memset_chk',
inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field();
| ^~~~~~~~~~~~~~~~~~~~~~~~
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419
Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Yang Yingliang [Thu, 17 Jun 2021 07:23:29 +0000 (09:23 +0200)]
media: atomisp: pci: fix error return code in atomisp_pci_probe()
If init_atomisp_wdts() fails, atomisp_pci_probe() need return
error code.
Link: https://lore.kernel.org/linux-media/20210617072329.1233662-1-yangyingliang@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio M. De Francesco [Sat, 5 Jun 2021 02:08:55 +0000 (04:08 +0200)]
media: atomisp: pci: Remove unnecessary (void *) cast
Removed an unnecessary (void *) cast for an argument passed to kfree().
Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio M. De Francesco [Thu, 27 May 2021 19:39:22 +0000 (21:39 +0200)]
media: atomisp: pci: Remove checks before kfree/kvfree
Removed checks for pointers != NULL before freeing memory. If kvfree()
and kfree() are given NULL pointers no operations are performed, so
there is no need for the above-mentioned checks. Coccinelle detected the
second of the two unnecessary checks.
Link: https://lore.kernel.org/linux-media/20210527193922.25225-1-fmdefrancesco@gmail.com
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:22 +0000 (14:43 +0200)]
media: atomisp: Remove unused port_enabled variable
Remove unused port_enabled variable in ia_css_isys_rx_configure().
Link: https://lore.kernel.org/linux-media/20210526124322.48915-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:20 +0000 (14:43 +0200)]
media: atomisp: Annotate a couple of definitions with __maybe_unused
There are definitions in the header that are not used by all modules inside
the driver. Annotate them with __maybe_unused to avoid compiler warnings.
Link: https://lore.kernel.org/linux-media/20210526124322.48915-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Andy Shevchenko [Wed, 26 May 2021 12:43:19 +0000 (14:43 +0200)]
media: atomisp: Remove unused declarations
There is a few static declarations that are not used anywhere, remove them.
Link: https://lore.kernel.org/linux-media/20210526124322.48915-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Shaokun Zhang [Tue, 25 May 2021 06:02:39 +0000 (08:02 +0200)]
media: atomisp: remove the repeated declaration
Function 'ia_css_mmu_invalidate_cache' is declared twice, remove the
repeated declaration.
Link: https://lore.kernel.org/linux-media/1621922559-1859-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tom Rix [Fri, 21 May 2021 19:48:05 +0000 (21:48 +0200)]
media: atomisp: improve error handling in gc2235_detect()
Static analysis reports this representative problem
atomisp-gc2235.c:867:20: warning: The right operand
of '|' is a garbage value
id = ((high << 8) | low);
^ ~~~
When gc2235_read_reg() fails, its return val is never written.
For gc2235_detect(), high and low are or-ed and compared
with GC2235_ID, 0x2235. Initialize both to 0 and skip
checking the read returns, it's errors are not passed up, only
-ENODEV is.
Link: https://lore.kernel.org/linux-media/20210521194805.2078135-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Aniket Bhattacharyea [Mon, 24 May 2021 17:36:09 +0000 (19:36 +0200)]
media: atomisp: Fix whitespace at the beginning of line
This patch fixes whitespace at the beginning of line by wrapping after
the type name and aligning the arguments with the open parenthesis.
Identified by checkpatch: WARNING: please, no spaces at the start of a
line.
Link: https://lore.kernel.org/linux-media/20210524173609.672153-1-aniketmail669@gmail.com
Signed-off-by: Aniket Bhattacharyea <aniketmail669@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jiabing Wan [Tue, 18 May 2021 11:29:35 +0000 (13:29 +0200)]
media: atomisp: Align block comments
Fixing the following checkpatch warning:
WARNING: Block comments should align the * on each line
Link: https://lore.kernel.org/linux-media/20210518112938.88240-1-wanjiabing@vivo.com
Signed-off-by: Jiabing Wan <kael_w@yeah.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Nguyen Dinh Phi [Thu, 13 May 2021 03:46:50 +0000 (05:46 +0200)]
media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.
Link: https://lore.kernel.org/linux-media/20210513034650.252993-1-phind.uet@gmail.com
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:22 +0000 (01:56 +0200)]
media: atomisp: Fix line continuation style issue in sh_css.c
Fix logical continuation style issue and adjacent line splits.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-5-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:21 +0000 (01:56 +0200)]
media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
Use kcalloc instead of kzalloc with multiplication.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-4-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:20 +0000 (01:56 +0200)]
media: atomisp: Remove unnecessary parens in sh_css.c
Remove unnecessary parenthesis.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Martiros Shakhzadyan [Sat, 8 May 2021 23:56:19 +0000 (01:56 +0200)]
media: atomisp: Resolve goto style issue in sh_css.c
Change the goto label to lower case.
Remove a space in the goto label.
Link: https://lore.kernel.org/linux-media/20210508235622.300394-2-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Baokun Li [Thu, 17 Jun 2021 14:09:26 +0000 (16:09 +0200)]
media: atomisp: use list_splice_init in atomisp_compat_css20.c
Using list_splice_init() instead of entire while-loops
in atomisp_compat_css20.c.
Link: https://lore.kernel.org/linux-media/20210617140926.887680-1-libaokun1@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Yizhuo [Fri, 25 Jun 2021 05:38:56 +0000 (07:38 +0200)]
media: atomisp: fix the uninitialized use and rename "retvalue"
Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.
The local variable "retvalue" is renamed to "model" to avoid
confusion.
Link: https://lore.kernel.org/linux-media/20210625053858.3862-1-yzhai003@ucr.edu
Fixes: ad85094 (media / atomisp: fix the uninitialized use of model ID)
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Pavel Skripkin [Sat, 8 May 2021 13:17:27 +0000 (15:17 +0200)]
media: atomisp: remove useless returns
Returns are not useful at the end of void functions,
they can simply be removed.
Link: https://lore.kernel.org/linux-media/23a6984ddfb15ba38f6983381bb6fdaef3edd7d8.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Pavel Skripkin [Sat, 8 May 2021 13:17:20 +0000 (15:17 +0200)]
media: atomisp: remove dublicate code
Removed dublicate returns and breaks inside switch
statements and useless return after switch.
Link: https://lore.kernel.org/linux-media/3944cd10bb5a64157781b1e0ef044c62c05f07c7.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Pavel Skripkin [Sat, 8 May 2021 13:17:12 +0000 (15:17 +0200)]
media: atomisp: remove useless breaks
Breaks are not useful after a return, they can
simply be removed.
Link: https://lore.kernel.org/linux-media/4b4a6ad1bc8fc1fd6aafc3e6cd7a4969890340c1.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dmitrii Wolf [Sun, 11 Apr 2021 13:48:41 +0000 (15:48 +0200)]
media: atomisp: pci: fixed a curly bracket coding style issue.
Fixed a coding style issue.
Link: https://lore.kernel.org/linux-media/20210411134840.7184-1-dev.dragon@bk.ru
Signed-off-by: Dmitrii Wolf <dev.dragon@bk.ru>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dinghao Liu [Thu, 8 Apr 2021 08:18:43 +0000 (10:18 +0200)]
media: atomisp: Fix runtime PM imbalance in atomisp_pci_probe
When hmm_pool_register() fails, a pairing PM usage counter
increment is needed to keep the counter balanced. It's the
same for the following error paths.
Link: https://lore.kernel.org/linux-media/20210408081850.24278-1-dinghao.liu@zju.edu.cn
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Bhaskar Chowdhury [Wed, 24 Mar 2021 13:56:42 +0000 (14:56 +0100)]
media: atomisp-ov2680: A trivial typo fix
s/miror/mirror/
Link: https://lore.kernel.org/linux-media/20210324135642.30054-1-unixbhaskar@gmail.com
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ricardo Ribalda [Thu, 18 Mar 2021 20:22:16 +0000 (21:22 +0100)]
media: atomisp: Fix typo "accesible"
Trivial fix.
Link: https://lore.kernel.org/linux-media/20210318202223.164873-2-ribalda@chromium.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Philipp Zabel [Mon, 19 Jul 2021 14:57:08 +0000 (16:57 +0200)]
media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats
The frame memory control register value is currently determined
before userspace selects the final capture format and never corrected.
Update ctx->frame_mem_ctrl in __coda_start_decoding() to fix decoding
into YUV420 or YVU420 capture buffers.
Reported-by: Andrej Picej <andrej.picej@norik.com>
Fixes:
497e6b8559a6 ("media: coda: add sequence initialization work")
Signed-off-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>
Tom Rix [Fri, 16 Jul 2021 19:17:33 +0000 (21:17 +0200)]
media: ti-vpe: cal: fix indexing of cal->ctx[] in cal_probe()
cal->ctx[i] is allocated with this loop
for (i = 0; i < cal->data->num_csi2_phy; ++i) {
and accessed in the error handler and else where with this loop
for (i = 0; i < cal->num_contexts; i++)
Because the first loop contains a continue statement
before cal->num_contexts is incremented, using i as the
indexer will leave gaps in the cal->ctx[].
So use cal->num_contexts as the indexer.
Fixes:
75e7e58bfac1 ("media: ti-vpe: cal: support 8 DMA contexts")
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>
Dan Carpenter [Tue, 13 Jul 2021 09:24:10 +0000 (11:24 +0200)]
media: rockchip/rga: fix error handling in probe
There are a few bugs in this code. 1) No checks for whether
dma_alloc_attrs() or __get_free_pages() failed. 2) If
video_register_device() fails it doesn't clean up the dma attrs or the
free pages. 3) The video_device_release() function frees "vfd" which
leads to a use after free on the next line. The call to
video_unregister_device() is not required so I have just removed that.
Fixes:
f7e7b48e6d79 ("[media] rockchip/rga: v4l2 m2m support")
Reported-by: Dongliang Mu <mudongliangabcd@gmail.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>
Evgeny Novikov [Sat, 10 Jul 2021 12:04:32 +0000 (14:04 +0200)]
media: platform: stm32: unprepare clocks at handling errors in probe
stm32_cec_probe() did not unprepare clocks on error handling paths. The
patch fixes that.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Pavel Skripkin [Wed, 7 Jul 2021 17:54:30 +0000 (19:54 +0200)]
media: stkwebcam: fix memory leak in stk_camera_probe
My local syzbot instance hit memory leak in usb_set_configuration().
The problem was in unputted usb interface. In case of errors after
usb_get_intf() the reference should be putted to correclty free memory
allocated for this interface.
Fixes:
ec16dae5453e ("V4L/DVB (7019): V4L: add support for Syntek DC1125 webcams")
Cc: stable@vger.kernel.org
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Mon, 28 Jun 2021 08:23:49 +0000 (10:23 +0200)]
media: media/cec-core.rst: update adap_enable doc
The description of adap_enable was out-of-date. Improve it so that it
corresponds to what really happens.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dafna Hirschfeld [Fri, 25 Jun 2021 08:23:09 +0000 (10:23 +0200)]
media: rkisp1: cap: initialize dma buf address in 'buf_init' cb
Initializing the dma addresses of the capture buffers can
move to the 'buf_init' callback, since it is enough to do
it once for each buffer and not every time it is queued.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dafna Hirschfeld [Fri, 25 Jun 2021 08:23:08 +0000 (10:23 +0200)]
media: rkisp1: remove field 'vaddr' from 'rkisp1_buffer'
The virtual address can be accessed using vb2_plane_vaddr
therefore there is no need to save it in an extra field in
'rkisp1_buffer'. Remove it.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Tue, 22 Jun 2021 14:31:53 +0000 (16:31 +0200)]
media: v4l2-subdev: fix some NULL vs IS_ERR() checks
The v4l2_subdev_alloc_state() function returns error pointers, it
doesn't return NULL.
Fixes:
0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-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>
Pavel Skripkin [Sun, 20 Jun 2021 19:45:42 +0000 (21:45 +0200)]
media: go7007: remove redundant initialization
In go7007_alloc() kzalloc() is used for struct go7007
allocation. It means that there is no need in zeroing
any members, because kzalloc will take care of it.
Removing these reduntant initialization steps increases
execution speed a lot:
Before:
+ 86.802 us | go7007_alloc();
After:
+ 29.595 us | go7007_alloc();
Fixes:
866b8695d67e8 ("Staging: add the go7007 video driver")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Pavel Skripkin [Sun, 20 Jun 2021 19:45:02 +0000 (21:45 +0200)]
media: go7007: fix memory leak in go7007_usb_probe
In commit
137641287eb4 ("go7007: add sanity checking for endpoints")
endpoint sanity check was introduced, but if check fails it simply
returns with leaked pointers.
Cutted log from my local syzbot instance:
BUG: memory leak
unreferenced object 0xffff8880209f0000 (size 8192):
comm "kworker/0:4", pid 4916, jiffies
4295263583 (age 29.310s)
hex dump (first 32 bytes):
30 b0 27 22 80 88 ff ff 75 73 62 2d 64 75 6d 6d 0.'"....usb-dumm
79 5f 68 63 64 2e 33 2d 31 00 00 00 00 00 00 00 y_hcd.3-1.......
backtrace:
[<
ffffffff860ca856>] kmalloc include/linux/slab.h:556 [inline]
[<
ffffffff860ca856>] kzalloc include/linux/slab.h:686 [inline]
[<
ffffffff860ca856>] go7007_alloc+0x46/0xb40 drivers/media/usb/go7007/go7007-driver.c:696
[<
ffffffff860de74e>] go7007_usb_probe+0x13e/0x2200 drivers/media/usb/go7007/go7007-usb.c:1114
[<
ffffffff854a5f74>] usb_probe_interface+0x314/0x7f0 drivers/usb/core/driver.c:396
[<
ffffffff845a7151>] really_probe+0x291/0xf60 drivers/base/dd.c:576
BUG: memory leak
unreferenced object 0xffff88801e2f2800 (size 512):
comm "kworker/0:4", pid 4916, jiffies
4295263583 (age 29.310s)
hex dump (first 32 bytes):
00 87 40 8a ff ff ff ff 00 00 00 00 00 00 00 00 ..@.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<
ffffffff860de794>] kmalloc include/linux/slab.h:556 [inline]
[<
ffffffff860de794>] kzalloc include/linux/slab.h:686 [inline]
[<
ffffffff860de794>] go7007_usb_probe+0x184/0x2200 drivers/media/usb/go7007/go7007-usb.c:1118
[<
ffffffff854a5f74>] usb_probe_interface+0x314/0x7f0 drivers/usb/core/driver.c:396
[<
ffffffff845a7151>] really_probe+0x291/0xf60 drivers/base/dd.c:576
Fixes:
137641287eb4 ("go7007: add sanity checking for endpoints")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Matthew Michilot [Fri, 4 Jun 2021 21:22:17 +0000 (23:22 +0200)]
media: i2c: adv7180: fix adv7280 BT.656-4 compatibility
Captured video would be out of sync when using the adv7280 with
the BT.656-4 protocol. Certain registers (0x04, 0x31, 0xE6) had to
be configured properly to ensure BT.656-4 compatibility.
An error in the adv7280 reference manual suggested that EAV/SAV mode
was enabled by default, however upon inspecting register 0x31, it was
determined to be disabled by default.
[fabio: Introduce "adv,force-bt656-4" to not affect the existing users]
[hverkuil: fix a small checkpatch alignment warning]
Signed-off-by: Matthew Michilot <matthew.michilot@gmail.com>
Reviewed-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio Estevam [Fri, 4 Jun 2021 21:22:16 +0000 (23:22 +0200)]
media: dt-bindings: adv7180: Introduce 'adv,force-bt656-4' property
Captured NTSC video would be out of sync when using the adv7280 with
the BT.656-4 protocol. Certain registers (0x04, 0x31, 0xE6) need to
be configured properly to ensure BT.656-4 compatibility.
Introduce the 'adv,force-bt656-4' property to allow the ADV7280
behavior to be consistent with the ADV7180, where BT.656-4 timing
is used by default.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio Estevam [Mon, 31 May 2021 11:22:37 +0000 (13:22 +0200)]
media: i2c: adv7180: Print the chip ID on probe
Improve the probe message by printing the chip ID version.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Frieder Schrempf [Mon, 31 May 2021 11:22:36 +0000 (13:22 +0200)]
media: adv7180: Add optional reset GPIO
There is a reset input that can be controlled by GPIO. Let's add it
to let the driver control it if required.
[hverkuil: fix a small checkpatch alignment warning]
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fabio Estevam [Mon, 31 May 2021 11:22:35 +0000 (13:22 +0200)]
media: dt-bindings: adv7180: Introduce the 'reset-gpios' property
Introduce the 'reset-gpios' property to describe the GPIO that connects
to the ADV7180 reset pin.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Paul Kocialkowski [Mon, 19 Jul 2021 20:52:41 +0000 (22:52 +0200)]
media: dt-bindings: media: rockchip-vpu: Add PX30 compatible
The Rockchip PX30 SoC has a Hantro VPU that features a decoder (VDPU2)
and an encoder (VEPU2).
Suggested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Paul Kocialkowski [Mon, 19 Jul 2021 20:52:40 +0000 (22:52 +0200)]
media: hantro: Add support for the Rockchip PX30
The PX30 SoC includes both the VDPU2 and VEPU2 blocks which are similar
to the RK3399 (Hantro G1/H1 with shuffled registers).
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:39 +0000 (22:52 +0200)]
media: hantro: Enable H.264 on Rockchip VDPU2
Given H.264 support for VDPU2 was just added, let's enable it.
For now, this is only enabled on platform that don't have
an RKVDEC core, such as RK3328.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jonas Karlman [Mon, 19 Jul 2021 20:52:38 +0000 (22:52 +0200)]
media: hantro: Add H.264 support for Rockchip VDPU2
Rockchip VDPU2 core is present on RK3328, RK3326/PX30, RK3399
and others. It's similar to Hantro G1, but it's not compatible with it.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:37 +0000 (22:52 +0200)]
media: hantro: h264: Move reference picture number to a helper
Add a hantro_h264_get_ref_nbr() helper function to get the reference
picture numbers. This will be used by the Rockchip VDPU2 H.264 driver.
This idea was originally proposed by Jonas Karlman in
"[RFC 09/12] media: hantro: Refactor G1 H264 code"
posted a while ago.
Link: https://lore.kernel.org/linux-media/HE1PR06MB401165F2BA0AD8A634FDFAF2ACBF0@HE1PR06MB4011.eurprd06.prod.outlook.com/
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:36 +0000 (22:52 +0200)]
media: hantro: h264: Move DPB valid and long-term bitmaps
In order to reuse these bitmaps, move this process to
struct hantro_h264_dec_hw_ctx. This will be used by
the Rockchip VDPU2 H.264 driver.
This idea was originally proposed by Jonas Karlman
in "[RFC 08/12] media: hantro: Fix H264 decoding of field encoded content"
which was posted a while ago.
Link: https://lore.kernel.org/linux-media/HE1PR06MB4011EA39133818A85768B91FACBF0@HE1PR06MB4011.eurprd06.prod.outlook.com/
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:35 +0000 (22:52 +0200)]
media: hantro: Avoid redundant hantro_get_{dst,src}_buf() calls
Getting the next src/dst buffer is relatively expensive
so avoid doing it multiple times.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:34 +0000 (22:52 +0200)]
media: hantro: Make struct hantro_variant.init() optional
The hantro_variant.init() function is there for platforms
to perform hardware-specific initialization, such as
clock rate bumping.
Not all platforms require it, so make it optional.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ezequiel Garcia [Mon, 19 Jul 2021 20:52:33 +0000 (22:52 +0200)]
media: hantro: vp8: Move noisy WARN_ON to vpu_debug
When the VP8 decoders can't find a reference frame,
the driver falls back to the current output frame.
This will probably produce some undesirable results,
leading to frame corruption, but shouldn't cause
noisy warnings.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dongliang Mu [Mon, 21 Jun 2021 05:07:28 +0000 (07:07 +0200)]
media: dvb-usb: Fix error handling in dvb_usb_i2c_init
In dvb_usb_i2c_init, if i2c_add_adapter fails, it only prints an error
message, and then continues to set DVB_USB_STATE_I2C. This affects the
logic of dvb_usb_i2c_exit, which leads to that, the deletion of i2c_adap
even if the i2c_add_adapter fails.
Fix this by returning at the failure of i2c_add_adapter and then move
dvb_usb_i2c_exit out of the error handling code of dvb_usb_i2c_init.
Fixes:
13a79f14ab28 ("media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dongliang Mu [Fri, 25 Jun 2021 05:59:04 +0000 (07:59 +0200)]
media: dvb-usb: fix uninit-value in vp702x_read_mac_addr
If vp702x_usb_in_op fails, the mac address is not initialized.
And vp702x_read_mac_addr does not handle this failure, which leads to
the uninit-value in dvb_usb_adapter_dvb_init.
Fix this by handling the failure of vp702x_usb_in_op.
Fixes:
786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dongliang Mu [Fri, 25 Jun 2021 05:33:27 +0000 (07:33 +0200)]
media: dvb-usb: fix uninit-value in dvb_usb_adapter_dvb_init
If dibusb_read_eeprom_byte fails, the mac address is not initialized.
And nova_t_read_mac_address does not handle this failure, which leads to
the uninit-value in dvb_usb_adapter_dvb_init.
Fix this by handling the failure of dibusb_read_eeprom_byte.
Reported-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com
Fixes:
786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Sat, 3 Jul 2021 09:04:40 +0000 (11:04 +0200)]
media: rc: rename s_learning_mode() to s_wideband_receiver()
The s_learning_mode() function is called in response to the ioctl
LIRC_SET_WIDEBAND_RECEIVER, so rename it to s_wideband_receiver().
Learning mode is when both the wideband receiver is turned on and
carrier reports are enabled.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Mon, 5 Jul 2021 17:56:01 +0000 (19:56 +0200)]
media: rc-loopback: max_timeout of UINT_MAX does not work
Any timeout larger than LIRC_VALUE_MASK cannot work for the lirc uapi.
LIRC_VALUE_MASK is about 16 seconds which is more than enough.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Sat, 3 Jul 2021 13:51:10 +0000 (15:51 +0200)]
media: rc-loopback: send carrier reports
When carrier reports are enabled, send them over loopback.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Sat, 3 Jul 2021 13:36:15 +0000 (15:36 +0200)]
media: rc-loopback: use dev_dbg() rather than handrolled debug
Make use of dynamic debug.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sean Young [Sat, 3 Jul 2021 13:37:17 +0000 (15:37 +0200)]
media: rc-loopback: return number of emitters rather than error
The LIRC_SET_TRANSMITTER_MASK ioctl should return the number of emitters
if an invalid list was set.
Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Uwe Kleine-König [Sat, 12 Jun 2021 09:13:51 +0000 (11:13 +0200)]
media: usb: dvb-usb-v2: af9035: let subdrv autoselect enable si2168 and si2157
The Logilink VG0022A DVB-T2 stick has these three devices. So to enable
support for this stick in the presence of MEDIA_SUBDRV_AUTOSELECT,
let DVB_USB_AF9035 select the two other drivers.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Uwe Kleine-König [Sat, 12 Jun 2021 09:13:50 +0000 (11:13 +0200)]
media: usb: dvb-usb-v2: af9035: report if i2c client isn't bound
If a sub device doesn't immediately bind after it was added, emit an
error indication to the kernel log to help debugging. This happens for
example if the needed driver isn't available at all.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
lijian [Fri, 18 Jun 2021 07:17:57 +0000 (09:17 +0200)]
media: dvb-frontends: cx24117: Delete 'break' after 'goto'
break is not useful after a goto, so delete 'break' after 'goto'.
Signed-off-by: lijian <lijian@yulong.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Thu, 10 Jun 2021 19:54:31 +0000 (21:54 +0200)]
media: cxd2880-spi: Fix an error handling path
If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.
Fix the error handling path of the probe accordingly.
Fixes:
cb496cd472af ("media: cxd2880-spi: Add optional vcc regulator")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
lijian [Thu, 10 Jun 2021 09:27:25 +0000 (11:27 +0200)]
media: rc: rc-main.c: deleted the repeated word
deleted the repeated word 'the' in the comments.
Signed-off-by: lijian <lijian@yulong.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
lijian [Thu, 10 Jun 2021 03:24:13 +0000 (05:24 +0200)]
media: rc: redrat3: Fix a typo
Change 'an' to 'on'.
Signed-off-by: lijian <lijian@yulong.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>