Commit graph

1058221 commits

Author SHA1 Message Date
Cai Huoqing 8d395ce6f0 media: dvb-core: Convert to SPDX identifier
use SPDX-License-Identifier instead of a verbose license text
and remove verbose license text.

Link: https://lore.kernel.org/linux-media/20210916020018.8550-1-caihuoqing@baidu.com

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 15:22:13 +00:00
Wang Hai ab599eb118 media: dmxdev: fix UAF when dvb_register_device() fails
I got a use-after-free report:

dvbdev: dvb_register_device: failed to create device dvb1.dvr0 (-12)
...
==================================================================
BUG: KASAN: use-after-free in dvb_dmxdev_release+0xce/0x2f0
...
Call Trace:
 dump_stack_lvl+0x6c/0x8b
 print_address_description.constprop.0+0x48/0x70
 kasan_report.cold+0x82/0xdb
 __asan_load4+0x6b/0x90
 dvb_dmxdev_release+0xce/0x2f0
...
Allocated by task 7666:
 kasan_save_stack+0x23/0x50
 __kasan_kmalloc+0x83/0xa0
 kmem_cache_alloc_trace+0x22e/0x470
 dvb_register_device+0x12f/0x980
 dvb_dmxdev_init+0x1f3/0x230
...
Freed by task 7666:
 kasan_save_stack+0x23/0x50
 kasan_set_track+0x20/0x30
 kasan_set_free_info+0x24/0x40
 __kasan_slab_free+0xf2/0x130
 kfree+0xd1/0x5c0
 dvb_register_device.cold+0x1ac/0x1fa
 dvb_dmxdev_init+0x1f3/0x230
...

When dvb_register_device() in dvb_dmxdev_init() fails, dvb_dmxdev_init()
does not return a failure, and the memory pointed to by dvbdev or
dvr_dvbdev is invalid at this point. If they are used subsequently, it
will result in UFA or null-ptr-deref.

If dvb_register_device() in dvb_dmxdev_init() fails, fix the bug by making
dvb_dmxdev_init() return an error as well.

Link: https://lore.kernel.org/linux-media/20211015085741.1203283-1-wanghai38@huawei.com

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 15:17:57 +00:00
Martin Weber ea8587d9de media: coda: V4L2_PIX_FMT_GREY for coda960 JPEG Encoder
support greyscale pix fmt input for coda9_jpeg_encoder. The hardware
supports it, so allow V4L2 Mem2Mem JPEG Encoder use it as well. Tested
on an i.MX6QP.

[hverkuil: updated the Subject line as suggested by Philipp]

Signed-off-by: Martin Weber <martin.weber@br-automation.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>
2021-11-19 06:10:06 +00:00
Niklas Söderlund dca7cc1cbd media: rcar-vin: Free buffers with error if hardware stop fails
The driver already has logic to detect if it fails to stop properly and
report this error to the user. The driver however did not report the
unused buffers or buffers given to the hardware (if any) with an error,
the buffers where instead returned to user-space in the active state.

Build on the existing detection of the error condition and correctly
return the buffers with an error if it triggers.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:09:44 +00:00
Dorota Czaplejewicz 0bbaec386c media: imx: Remove unused functions
Neither imx_media_mbus_fmt_to_ipu_image nor imx_media_ipu_image_to_mbus_fmt
were used anywhere.

Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:09:21 +00:00
Johan Hovold 6aa6e70cdb media: stk1160: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 9cb2173e6e ("[media] media: Add stk1160 new driver (easycap replacement)")
Cc: stable@vger.kernel.org      # 3.7
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:08:52 +00:00
Johan Hovold f71d272ad4 media: s2255: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Use the common control-message timeout define for the five-second
timeouts.

Fixes: 38f993ad8b ("V4L/DVB (8125): This driver adds support for the Sensoray 2255 devices.")
Cc: stable@vger.kernel.org      # 2.6.27
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:08:32 +00:00
Johan Hovold b82bf9b9dc media: pvrusb2: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: d855497edb ("V4L/DVB (4228a): pvrusb2 to kernel 2.6.18")
Cc: stable@vger.kernel.org      # 2.6.18
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:06:12 +00:00
Johan Hovold d9b7e8df3a media: em28xx: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: a6c2ba2835 ("[PATCH] v4l: 716: support for em28xx board family")
Cc: stable@vger.kernel.org      # 2.6.16
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:05:33 +00:00
Johan Hovold 10729be033 media: cpia2: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: ab33d5071d ("V4L/DVB (3376): Add cpia2 camera support")
Cc: stable@vger.kernel.org      # 2.6.17
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:05:12 +00:00
Johan Hovold cd1798a387 media: flexcop-usb: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Note that the driver was multiplying some of the timeout values with HZ
twice resulting in 3000-second timeouts with HZ=1000.

Also note that two of the timeout defines are currently unused.

Fixes: 2154be651b ("[media] redrat3: new rc-core IR transceiver device driver")
Cc: stable@vger.kernel.org      # 3.0
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:04:53 +00:00
Johan Hovold 2adc965c8b media: redrat3: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 2154be651b ("[media] redrat3: new rc-core IR transceiver device driver")
Cc: stable@vger.kernel.org      # 3.0
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:04:16 +00:00
Johan Hovold 16394e998c media: mceusb: fix control-message timeouts
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 66e89522af ("V4L/DVB: IR: add mceusb IR receiver driver")
Cc: stable@vger.kernel.org      # 2.6.36
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:03:51 +00:00
Dafna Hirschfeld 10d0f56800 media: mtk-vcodec: remove unused func parameter
The prarameter bs_size to function vpu_enc_encode
is not used. Remove it.

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>
2021-11-19 06:03:24 +00:00
Dafna Hirschfeld 37365b050d media: mtk-vcodec: enc: add vp8 profile ctrl
In order for the encoder to work with gstreamer
it needs to have the V4L2_CID_MPEG_VIDEO_VP8_PROFILE
ctrl. This patch adds that ctrl with only profile 0
supported.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 06:02:52 +00:00
Mauro Carvalho Chehab 999ed03518 media: atomisp: cleanup qbuf logic
The logic there is meant to be used by newer firmwares.
clean it up, in order to make compatible with the chosen
firmware version.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:40:19 +00:00
Mauro Carvalho Chehab 3c82bf0295 media: atomisp: add YUVPP at __atomisp_get_pipe() logic
Aligns it which the Intel Aero firmware.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:38:39 +00:00
Mauro Carvalho Chehab 72fb16a130 media: atomisp: frame.c: drop a now-unused function
ia_css_frame_find_crop_resolution() is not used anymore.

So, remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:38:03 +00:00
Mauro Carvalho Chehab c37ed67335 media: atomisp: pipe_binarydesc: drop logic incompatible with firmware
As we're using this firmware for ISP2401:
	https://github.com/intel-aero/meta-intel-aero-base/blob/master/recipes-kernel/linux/linux-yocto/shisp_2401a0_v21.bin

Revert some changes that are not compatible with it, making
the code close to the Intel Aero one.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:37:29 +00:00
Mauro Carvalho Chehab 5c5a95385a media: atomisp: binary.c: drop logic incompatible with firmware
As we're using this firmware for ISP2401:
	https://github.com/intel-aero/meta-intel-aero-base/blob/master/recipes-kernel/linux/linux-yocto/shisp_2401a0_v21.bin

It makes no sense to try to select a non-existing binary
inside the firmware. So, revert it to reflect the Intel Aero
device driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:36:42 +00:00
Mauro Carvalho Chehab 4f948a3283 media: atomisp: simplify binary.c
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:36:08 +00:00
Mauro Carvalho Chehab 3f323bb4cf media: atomisp: get rid of set pipe version custom ctrl
It doesn't make sense to have a control for that. Besides that,
the Intel Aero implementation doesn't have, which means that
even the custom control is not used in practice, at least
outside Android.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:35:46 +00:00
Mauro Carvalho Chehab 13d72e6942 media: atomisp: atomisp_cmd: make it more compatible with firmware
Change some recovery logic at the driver, in order to make it
more compatible with ISP2401 Intel Aero firmware.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 19:35:25 +00:00
Mauro Carvalho Chehab 072927d1ce media: atomisp: sh_css_sp: better support the current firmware
As we're using Intel Aero firmware, make the code closer to the
driver for such device.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 13:44:48 +00:00
Mauro Carvalho Chehab 3b941c5a19 media: atomisp: sh_css_param_shading: fix comments coding style
The comments are not following Kernel coding style.

Also, there are two missing comments that are found at the Intel Aero
device driver code. Add them.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:51:29 +00:00
Mauro Carvalho Chehab 50f1d9343b media: atomisp: get rid of sctbl_legacy_*
Those seem to be used only on certain ISP2401 firmwares that
aren't supported by the driver. So, get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:47:33 +00:00
Mauro Carvalho Chehab c0a7df148e media: atomisp: get rid of #ifdef HAS_BL
This does nothing but declare extern to a non-existing var.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:39:17 +00:00
Mauro Carvalho Chehab d7ab37bcdd media: atomisp: get rid of USE_WINDOWS_BINNING_FACTOR tests
This is meant to select a platform-dependent factor between
Linux and Windows. It makes no sense to keep it on Kernel.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:38:34 +00:00
Mauro Carvalho Chehab 63705da3df media: atomisp: remove #ifdef HAS_NO_HMEM
This is not defined anywhere, so, solve the ifdefs, getting
rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:32:47 +00:00
Mauro Carvalho Chehab 35009261b9 media: atomisp: sh_css_params: cleanup the code
Now that the tests for the new ISP2401 input system were
dropped, simplify the code, making it closer to the Intel
Aero device driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:32:19 +00:00
Mauro Carvalho Chehab 037de9f2b2 media: atomisp: sh_css_params: remove tests for ISP2401
Those tests are related to the input system, which is the same
for the chosen firmware, so both ISP2400 and ISP2401 will be
identical with that regards.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:31:48 +00:00
Mauro Carvalho Chehab b541d4c992 media: atomisp: sh_css_mipi: cleanup the code
With the ISP2401 firmware we're using, the code differences
are not that much from ISP2400. Cleanup the code in order
to make it closer to Intel Aero driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:31:22 +00:00
Mauro Carvalho Chehab ef3f3627ff media: atomisp: sh_css_metrics: drop some unused code
There are two #ifdefs there which aren't defined anywhere.

So, just drop the dead code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:30:41 +00:00
Mauro Carvalho Chehab 839467839c media: atomisp: simplify sh_css_defs.h
There are several unused macros. Simplify the logic there, making
it closer to the Intel Aero driver and the corresponding firmware,
as this is what we have widely available for this device.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:30:21 +00:00
Mauro Carvalho Chehab da8fdf490b media: atomisp: drop empty files
There's nothing inside such files. Just drop them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-17 09:29:40 +00:00
Mauro Carvalho Chehab 5b49e068be media: atomisp: get rid of #ifdef ISP_VEC_NELEMS
This is defined as 64 for the devices/firmware that were chosen.

So, evaluate the macros accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:11 +00:00
Mauro Carvalho Chehab 912680064f media: atomisp: make sh_css similar to Intel Aero driver
As we're using the firmware from Intel Aero, ensure that the
logic inside sh_css as similar as possible to such driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab ec1804dadf media: atomisp: warn if mipi de-allocation failed
There's a note at the uninit function that warns about issues
with mipi frames de-allocation. print a warning if the problem
ever happens.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab dc41f7df78 media: atomisp: drop check_pipe_resolutions() logic
Such function doesn't exist on Intel Aero driver. As we're using
its firmware, it may mean that this is not compatible with the
current file. So, drop it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 37746513f6 media: atomisp: get rid of some weird warn-suppress logic
There are some dead code meant to suppress "C_RUN" warnings.

Drop it from sh_css.c, as it doesn't make much sense.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab e05b3bbbf1 media: atomisp: drop a dead code
There's a commented dead code related to some future thing
to be implemented. As this won't happen, as it would require
a newer firmware, just drop the code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 1de7694155 media: atomisp: drop ia_css_pipe_update_qos_ext_mapped_arg
This function is not used. Drop it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 6a28541ff5 media: atomisp: unify ia_css_stream stop logic
There are two versions of those functions. It turns that the
choosen firmware use the old version. So, drop the unused
ones and ensure that all devices will use the right functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 802dfce3b9 media: atomisp: get rid of ia_css_stream_load()
This function is marked as obsolete and nobody calls it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 0a9e6351ea media: atomisp: drop crop code at stream create function
The firmware chosen for ISP2401 doesn't support it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 2a01213bfa media: atomisp: solve #ifdef HAS_NO_PACKED_RAW_PIXELS
This was never defined, so remove the #ifdefs, keeping the
code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 9e22032e9c media: atomisp: remove #ifdef SH_CSS_ENABLE_METADATA
The chosen firmware has it enabled, so, drop this symbol.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 52481d4d31 media: atomisp: drop #ifdef WITH_PC_MONITORING
This is not needed for the driver to work. So, just drop it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 16d0c92ef8 media: atomisp: drop #ifdef SH_CSS_ENABLE_PER_FRAME_PARAMS
This is enabled for the firmware we're using. So, just drop
the if's.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:10 +00:00
Mauro Carvalho Chehab 29a3764a76 media: atomisp: remove #ifdef HAS_OUTPUT_SYSTEM
None of the firmwares we use has support for it. So, drop the
unused code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-16 14:37:09 +00:00