Mauro Carvalho Chehab [Wed, 17 Nov 2021 08:28:51 +0000 (08:28 +0000)]
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>
Mauro Carvalho Chehab [Wed, 17 Nov 2021 08:02:39 +0000 (08:02 +0000)]
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>
Mauro Carvalho Chehab [Wed, 17 Nov 2021 07:24:40 +0000 (07:24 +0000)]
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>
Mauro Carvalho Chehab [Wed, 17 Nov 2021 07:19:06 +0000 (07:19 +0000)]
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>
Mauro Carvalho Chehab [Wed, 17 Nov 2021 06:44:29 +0000 (06:44 +0000)]
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>
Mauro Carvalho Chehab [Wed, 17 Nov 2021 06:40:52 +0000 (06:40 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 14:45:55 +0000 (14:45 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 13:31:59 +0000 (13:31 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 12:39:37 +0000 (12:39 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 13:29:44 +0000 (13:29 +0000)]
media: atomisp: drop empty files
There's nothing inside such files. Just drop them.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 11:16:54 +0000 (11:16 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 17:32:45 +0000 (17:32 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 09:13:32 +0000 (09:13 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 18:54:50 +0000 (18:54 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 18:43:22 +0000 (18:43 +0000)]
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>
Mauro Carvalho Chehab [Tue, 16 Nov 2021 09:13:38 +0000 (09:13 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 22:34:08 +0000 (22:34 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 19:40:26 +0000 (19:40 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 19:35:02 +0000 (19:35 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 18:48:50 +0000 (18:48 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 23:33:01 +0000 (23:33 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 22:19:50 +0000 (22:19 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 15:46:36 +0000 (15:46 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 12:13:13 +0000 (12:13 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 18:12:56 +0000 (18:12 +0000)]
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>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 16:05:51 +0000 (16:05 +0000)]
media: atomisp: drop an useless #ifdef ISP2401
The Yocto Aero driver for ISP2401 sets my_css_save.loaded_fw.
As we're using the same firmware, remove the ifdef there.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 15:53:12 +0000 (15:53 +0000)]
media: atomisp: drop two vars that are currently ignored
Those two vars are meaningful only with some ISP2401 firmwares.
The one we chose to support doesn't use, so simply drop the
extra code.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 12:18:52 +0000 (12:18 +0000)]
media: atomisp: Avoid some {} just to define new vars
There are a couple of places where {} are used just to
define a new var. Just move the var to the top of the function
and get rid of that ugly blocks.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Mon, 15 Nov 2021 12:05:25 +0000 (12:05 +0000)]
media: atomisp: fix comments coding style at sh_css.c
Use the coding style for the comments at this file.
While here, drop a do-nothing if logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Sun, 14 Nov 2021 11:44:37 +0000 (11:44 +0000)]
media: atomisp: ia_css_stream.h: remove ifdefs from the header
Now that the input system always declare rx_cfg_t, we can
remove the ifdef ISP2401 from this header.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Sun, 14 Nov 2021 11:06:24 +0000 (11:06 +0000)]
media: atomisp: shift some structs from input_system_local
There are several stucts under ISP2400 that could be moved
to the global file without causing any build issues.
Move those to the common header, in order to reduce the number
of things that are #ifdef dependent.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Sun, 14 Nov 2021 09:23:21 +0000 (09:23 +0000)]
media: atomisp: get rid of if CONFIG_ON_FRAME_ENQUEUE
This is not used with supported firmwares, so get rid of such code.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 12 Nov 2021 11:43:17 +0000 (11:43 +0000)]
media: atomisp: get rid of phys event abstractions
ia_css_dequeue_event() is just an alias to ia_css_dequeue_psys_event(),
and atomisp_css_dequeue_event() do nothing but calling the event
dequeue logic.
Get rid of both abstractions, calling the function directly.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 23:04:09 +0000 (23:04 +0000)]
media: atomisp: handle errors at sh_css_create_isp_params()
The succ var tracks memory allocation erros on this function.
Fix it, in order to stop this W=1 Werror in clang:
drivers/staging/media/atomisp/pci/sh_css_params.c:2430:7: error: variable 'succ' set but not used [-Werror,-Wunused-but-set-variable]
bool succ = true;
^
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 11:04:31 +0000 (11:04 +0000)]
media: atomisp: implement enum framesize/frameinterval
Add logic to enumerate sensor's frame size and interval.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 10:15:44 +0000 (10:15 +0000)]
media: atomisp-ov2680: implement enum frame intervals
Allow the sensor to report the per-resolution frame interval.
It should be noticed that, despite the ov2680 datasheet says
that, for resolutions <= 1280x720, the sensor supports 60fps,
the data at ov2680.h tells otherwise, limiting it to 30fps.
Not sure yet if this is a limitation of atomisp or if it is
just because the tables are incorrect.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 10:21:22 +0000 (10:21 +0000)]
media: atomisp-ov2680: adjust the maximum frame rate
The ov2680 supports a maximum bandwidth of 660Mbps and allows
up to 60fps when the resolution is below 720p.
Adjust the sensor's table to reflect that.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 08:50:53 +0000 (08:50 +0000)]
media: atomisp-ov2680: remove some unused fields
The sensor resolution arrays have two unused fields. Drop them.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 08:46:37 +0000 (08:46 +0000)]
media: atomisp-ov2680: uncomment other resolutions
There are several resolutions defined for this sensor, but just
two are currently uncommented. Change the driver to allow other
resolutions to also be used.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 22:58:38 +0000 (22:58 +0000)]
media: atomisp-gc2235: drop an unused var
Fix this clang Werror with W=1:
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c:573:6: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable]
int ret = -1;
^
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 11 Nov 2021 22:57:05 +0000 (22:57 +0000)]
media: ipu3: drop an unused variable
Fix this clang Werror with W=1:
drivers/staging/media/ipu3/ipu3-css-params.c:774:8: error: variable 'pin_scale' set but not used [-Werror,-Wunused-but-set-variable]
int pin_scale = 0;
^
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cai Huoqing [Tue, 9 Nov 2021 12:55:20 +0000 (12:55 +0000)]
media: rc: ir-hix5hd2: Add the dependency on HAS_IOMEM
The helper function devm_platform_ioremap_resource()
needs HAS_IOMEM enabled, so add the dependency on HAS_IOMEM.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
MaÃra Canal [Thu, 4 Nov 2021 18:50:18 +0000 (18:50 +0000)]
media: ir-rx51: Switch to atomic PWM API
Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.
Signed-off-by: MaÃra Canal <maira.canal@usp.br>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
MaÃra Canal [Wed, 27 Oct 2021 15:34:30 +0000 (16:34 +0100)]
media: rc: pwm-ir-tx: Switch to atomic PWM API
Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.
Signed-off-by: MaÃra Canal <maira.canal@usp.br>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Uwe Kleine-König [Wed, 20 Oct 2021 12:59:32 +0000 (13:59 +0100)]
media: rc: ir-spi: Drop empty spi_driver remove callback
A driver with a remove callback that just returns 0 behaves identically
to a driver with no remove callback at all. So simplify accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Thu, 14 Oct 2021 18:12:35 +0000 (19:12 +0100)]
media: mtk-vcodec: Remove redundant 'flush_workqueue()' calls
'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.
Remove the redundant 'flush_workqueue()' calls.
This was generated with coccinelle:
@@
expression E;
@@
- flush_workqueue(E);
destroy_workqueue(E);
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Thu, 14 Oct 2021 18:21:43 +0000 (19:21 +0100)]
media: mtk-vpu: Remove redundant 'flush_workqueue()' calls
'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.
Remove the redundant 'flush_workqueue()' calls.
This was generated with coccinelle:
@@
expression E;
@@
- flush_workqueue(E);
destroy_workqueue(E);
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Randy Dunlap [Sun, 7 Nov 2021 18:19:23 +0000 (18:19 +0000)]
media: correct MEDIA_TEST_SUPPORT help text
Fix grammar/wording in the help text for MEDIA_TEST_SUPPORT.
Fixes:
4b32216adb01 ("media: split test drivers from platform directory")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tzung-Bi Shih [Wed, 10 Nov 2021 07:56:11 +0000 (07:56 +0000)]
media: mtk-vcodec: vdec: remove redundant 'pfb' assignment
A clang-analyzer warning was reported.
>> drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c:133:18:
warning: Value stored to 'pfb' during its initialization is never
read [clang-analyzer-deadcode.DeadStores]
struct vdec_fb *pfb = &framebuf->frame_buffer;
^~~ ~~~~~~~~~~~~~~~~~~~~~~~
Removes the redundant 'pfb' assignment to fix.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dillon Min [Thu, 28 Oct 2021 06:40:20 +0000 (07:40 +0100)]
media: stm32-dma2d: fix compile-testing failed
get compile-test failed report from lkp@intel.com after the driver
submitted.
"ld.lld: error: undefined symbol: v4l2_fh_init"
so, make CONFIG_STM32_DMA2D depends on CONFIG_VIDEO_DEV and
CONFIG_VIDEO_V4L2 to fix this compile error.
Fixes:
bff6e3e2f4c9 ("media: stm32-dma2d: STM32 DMA2D driver")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dillon Min <dillon.minfei@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dillon Min [Sun, 7 Nov 2021 14:41:44 +0000 (14:41 +0000)]
media: stm32-dma2d: fix compile errors when W=1
remove unused functions to avoid compile errors when W=1.
>> drivers/media/platform/stm32/dma2d/dma2d-hw.c:29:20:
error: unused function 'reg_set' [-Werror,-Wunused-function]
static inline void reg_set(void __iomem *base, u32 reg, u32 mask)
>> drivers/media/platform/stm32/dma2d/dma2d-hw.c:34:20:
error: unused function 'reg_clear' [-Werror,-Wunused-function]
static inline void reg_clear(void __iomem *base, u32 reg, u32 mask)
Fixes:
bff6e3e2f4c9 ("media: stm32-dma2d: STM32 DMA2D driver")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dillon Min <dillon.minfei@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jammy Huang [Tue, 9 Nov 2021 03:12:27 +0000 (03:12 +0000)]
media: aspeed: Update signal status immediately to ensure sane hw state
If res-chg, VE_INTERRUPT_MODE_DETECT_WD irq will be raised. But
v4l2_input_status won't be updated to no-signal immediately until
aspeed_video_get_resolution() in aspeed_video_resolution_work().
During the period of time, aspeed_video_start_frame() could be called
because it doesn't know signal becomes unstable now. If it goes with
aspeed_video_init_regs() of aspeed_video_irq_res_change()
simultaneously, it will mess up hw state.
To fix this problem, v4l2_input_status is updated to no-signal
immediately for VE_INTERRUPT_MODE_DETECT_WD irq.
Fixes:
d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Mon, 8 Nov 2021 12:06:52 +0000 (12:06 +0000)]
media: drivers/index.rst: add missing rkisp1 entry
The Documentation/driver-api/media/drivers/rkisp1.rst file
wasn't referenced in the index.rst file, so it was never included.
Add it.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Yunfei Dong [Thu, 4 Nov 2021 12:24:26 +0000 (12:24 +0000)]
media: mtk-vcodec: Align width and height to 64 bytes
Width and height need to 64 bytes aligned when setting the format.
Need to make sure all is 64 bytes align when use width and height to
calculate buffer size.
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Steve Cho <stevecho@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Wed, 3 Nov 2021 12:28:31 +0000 (12:28 +0000)]
media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE
If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0,
otherwise v4l2-compliance will complain.
A note on the Fixes tag below: this patch does not really fix that commit,
but it can be applied from that commit onwards. For older code there is no
guarantee that device_caps is set, so even though this patch would apply,
it will not work reliably.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes:
049e684f2de9 (media: v4l2-dev: fix WARN_ON(!vdev->device_caps))
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans Verkuil [Tue, 2 Nov 2021 12:24:27 +0000 (12:24 +0000)]
media: cec-ioc-receive.rst: clarify sequence and status fields
Improve the documentation for CEC_RECEIVE/TRANSMIT w.r.t. the
sequence and tx/rx_status fields.
Also remove a duplicate tx_status description.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Kwang Son [Tue, 2 Nov 2021 11:17:47 +0000 (11:17 +0000)]
media: docs: Fix newline typo
Fix example code which has missing or double backslash typo.
Signed-off-by: Kwang Son <dev.kwang.son@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dongliang Mu [Mon, 1 Nov 2021 09:55:39 +0000 (09:55 +0000)]
media: em28xx: fix memory leak in em28xx_init_dev
In the em28xx_init_rev, if em28xx_audio_setup fails, this function fails
to deallocate the media_dev allocated in the em28xx_media_device_init.
Fix this by adding em28xx_unregister_media_device to free media_dev.
BTW, this patch is tested in my local syzkaller instance, and it can
prevent the memory leak from occurring again.
CC: Pavel Skripkin <paskripkin@gmail.com>
Fixes:
37ecc7b1278f ("[media] em28xx: add media controller support")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Niklas Söderlund [Thu, 28 Oct 2021 09:37:49 +0000 (10:37 +0100)]
media: dt-bindings: adv748x: Convert bindings to json-schema
Convert ADV748X analog video decoder documentation to json-schema.
While converting the bindings extend it to enforce that all port@n nodes
shall be encapsulated inside a ports node. This change does not have an
effect on drivers parsing the ports@n nodes.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-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>
Christophe JAILLET [Sat, 23 Oct 2021 10:10:48 +0000 (11:10 +0100)]
media: s5p-mfc: Use 'bitmap_zalloc()' when applicable
'mfc_dev->mem_bitmap' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic.
Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Kieran Bingham [Fri, 22 Oct 2021 10:06:44 +0000 (11:06 +0100)]
media: tw5864: Disable PCI device when finished
The cleanup in tw5864_finidev() neglected to disable the PCI device
after enabling it in tw5864_initdev().
Call pci_disable_device() after releasing the associated resources.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Christophe JAILLET [Sat, 16 Oct 2021 08:40:29 +0000 (09:40 +0100)]
media: tw5864: Simplify 'tw5864_finidev()'
Some resources are allocated with 'pci_request_regions()', so use
'pci_release_regions()' to free them, instead of a verbose
'release_mem_region()'.
There is no point in calling 'devm_kfree()'. The corresponding resource is
managed, so it will be fried automatically.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cai Huoqing [Thu, 21 Oct 2021 08:41:42 +0000 (09:41 +0100)]
media: gspca: Make use of the helper macro kthread_run()
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Jammy Huang [Wed, 3 Nov 2021 08:23:54 +0000 (08:23 +0000)]
media: aspeed: fix mode-detect always time out at 2nd run
aspeed_video_get_resolution() will try to do res-detect again if the
timing got in last try is invalid. But it will always time out because
VE_SEQ_CTRL_TRIG_MODE_DET is only cleared after 1st mode-detect.
To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before setting
it in aspeed_video_enable_mode_detect().
Fixes:
d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Xu Wang [Wed, 10 Nov 2021 09:49:10 +0000 (09:49 +0000)]
media: atomisp: Remove unneeded null check
In ia_css_frame_map, the check of 'err' is unneeded to be done twice.
Link: https://lore.kernel.org/linux-media/20211110094910.67951-1-vulab@iscas.ac.cn
Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 10 Nov 2021 11:43:46 +0000 (11:43 +0000)]
media: atomisp: get rid of atomisp_get_frame_pgnr() abstraction
Simplify the code by getting rid of this function, as it ends
being just a single line of code.
Link: https://lore.kernel.org/linux-media/80ea920d14379124ba92aab2e6a6d12a92d79b2b.1636544620.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 10 Nov 2021 13:08:28 +0000 (13:08 +0000)]
media: atomisp: simplify asd check on open() fops
The open() fops support two types of devices: "acc" and normal
ones. the acc works on a different way, using a different pipe
struct. Not sure yet if it would make sense to setup a run_mode
there. Also, As default_run_mode exists only on normal modes,
we can simplify the logic to check if the device is in normal
mode.
That solves this warning:
../drivers/staging/media/atomisp/pci/atomisp_fops.c:904 atomisp_open() warn: variable dereferenced before check 'asd' (see line 807)
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 10 Nov 2021 12:59:11 +0000 (12:59 +0000)]
media: atomisp: check before deference asd variable
The asd->isp was referenced before checking if asd is not
NULL.
This fixes this warning:
../drivers/staging/media/atomisp/pci/atomisp_cmd.c:5548 atomisp_set_fmt_to_snr() warn: variable dereferenced before check 'asd' (see line 5540)
While here, avoid getting the pipe pointer twice.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Mon, 8 Nov 2021 09:40:25 +0000 (09:40 +0000)]
media: atomisp: only initialize mode if pipe is not null
During atomisp register, udev tries to open all devices. For
some, pipe is NULL, at least during register time, causing the
driver to try to access a NULL pointer.
So, add an extra check to avoid such condition.
Link: https://lore.kernel.org/linux-media/6406265f2d5f3791d5c7cbd1364186217f19524c.1636364423.git.mchehab+huawei@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dan Carpenter [Tue, 12 Oct 2021 08:21:50 +0000 (09:21 +0100)]
media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr()
The "power" pointer is not initialized on the else path and that would
lead to an Oops.
Link: https://lore.kernel.org/linux-media/20211012082150.GA31086@kili
Fixes:
c30f4cb2d4c7 ("media: atomisp: Refactor PMIC detection to a separate function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 10 Nov 2021 10:55:39 +0000 (10:55 +0000)]
media: atomisp-ov2680: properly set the vts value
The vts value should be set before being checked, as otherwise a
warning will arise:
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function 'ov2680_set_fmt':
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:873:33: warning: 'vts' may be used uninitialized
[-Wmaybe-uninitialized]
873 | if (dev->exposure > vts - OV2680_INTEGRATION_TIME_MARGIN)
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Fixes:
62b984359b6f ("media: atomisp-ov2680: Fix ov2680_set_fmt() messing up high exposure settings")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 10 Nov 2021 10:54:41 +0000 (10:54 +0000)]
media: atomisp-ov2680: initialize return var
As the settings are only applied when the device is powered on,
it should return 0 when the device is not powered.
Not doing that causes a warning:
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c: In function 'ov2680_ioctl':
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:390:16: warning: 'ret' may be used uninitialized in this
function [-Wmaybe-uninitialized]
390 | return ov2680_set_exposure(sd, coarse_itg, analog_gain, digital_gain);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:359:13: note: 'ret' was declared here
359 | int ret;
| ^~~
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Fixes:
6b5b60687ada ("media: atomisp-ov2680: Save/restore exposure and gain over sensor power-down")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:49 +0000 (17:15 +0000)]
media: atomisp-ov2680: Fix ov2680_set_fmt() messing up high exposure settings
For exposure settings > (lines_per_frame - vts_margin) the VTS register
needs to be programmed to (exposure + vts_margin) rather then being
set to lines_per_frame.
The res->regs register array was clobbering this higher setting causing
high exposure settings to not work. Fix this by letting ov2680_set_fmt()
calculate the vts value, instead of hardcoding it.
This is the last in a series of fixes which fixes exposure and gain
settings not working, with this everything works, so drop the comment
that it does not work.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-12-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:48 +0000 (17:15 +0000)]
media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure
Now that we restore the default or last user set exposure setting on
power_up() there is no need for the registers written by ov2680_set_fmt()
to write to the exposure register.
Not doing so fixes the exposure always being reset to the value from
the res->regs array after a set_fmt().
Link: https://lore.kernel.org/linux-media/20211107171549.267583-11-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:47 +0000 (17:15 +0000)]
media: atomisp-ov2680: Fix ov2680_write_reg() always writing 0 to 16 bit registers
The shift << 16 of the value in the code path for 16 bit values is
bogus, put_unaligned_be16() takes the lower 16 bits which will not
always be 0.
This was causing __ov2680_set_exposure() to always set the
OV2680_AGC and OV2680_TIMING_VTS registers to 0.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-10-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:46 +0000 (17:15 +0000)]
media: atomisp-ov2680: Fix and simplify ov2680_q_exposure()
Switch to ov2680_read_reg() to read all 24 bits in one go;
and the exposure value sits in bits 4-19 of the 24 bit exposure
register, so we need to shift the read value by 4 to report the
correct value.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-9-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:45 +0000 (17:15 +0000)]
media: atomisp-ov2680: Make ov2680_read_reg() support 24 bit registers
Some ov2680 registers like exposure are 24 bit,
ov2680_read_reg() already mostly supports this, we just
need to change the return type from u16 to u32.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-8-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:44 +0000 (17:15 +0000)]
media: atomisp-ov2680: Save/restore exposure and gain over sensor power-down
Save/restore exposure and gain over sensor power-down and don't write them
to the sensor when ov2680_set_exposure() is called while the sensor is off.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-7-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:43 +0000 (17:15 +0000)]
media: atomisp-ov2680: Move ov2680_init_registers() call to power_up()
Move ov2680_init_registers() call to power_up(), so that we also
init the registers on code-paths which do not call ov2680_s_power()
like running camorama.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-6-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:42 +0000 (17:15 +0000)]
media: atomisp-ov2680: Remove the ov2680_res and N_RES global variables
The ov2680_res and N_RES global variables are just hardcoded as aliases
for ov2680_res_preview and N_RES_PREVIEW, remove them.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-5-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:41 +0000 (17:15 +0000)]
media: atomisp-ov2680: Push the input_lock taking up into ov2680_s_power()
ov2680_s_power() is the only caller of ov2680_init(), push the input_lock
taking from ov2680_init() up into ov2680_s_power(), this way the new
power_on bool is also protected by it.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-4-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:40 +0000 (17:15 +0000)]
media: atomisp-ov2680: Turn on power only once
Add a power_on bool to track if the power is on, and make
power_up() a no-op if the power is already on.
This also removes a power_down() call from ov2680_s_config() since
that is a no-op now, this is ok because s_config() is only called
once on probe and the sensor is off at boot.
Besides avoiding to the work in power_up() multiple times this patch
is also a preparation for switching to the clk and regulator frameworks
which keep an enable count, so there we must call enable() and
disable() only once per power-cycle.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-3-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Hans de Goede [Sun, 7 Nov 2021 17:15:39 +0000 (17:15 +0000)]
media: atomisp-ov2680: Remove a bunch of unused vars from ov2680_device
Remove a couple of variables which where either completely unused,
or only ever got a value assigned to them but were never read.
Link: https://lore.kernel.org/linux-media/20211107171549.267583-2-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Sat, 6 Nov 2021 11:26:20 +0000 (11:26 +0000)]
media: atomisp: register first the preview devnode
The atomisp currenyl registers 5 pairs of devices each one
for one different run_mode, plus one for "ACC". The only
one that behaves like a normal V4L2 device is the preview
one. The others are doing weird things, and perhaps are
using some proprietary extensions to the API.
Change the device order to start with the preview one,
e. g:
/dev/video0: ATOMISP ISP PREVIEW output
/dev/video1: ATOMISP ISP CAPTURE output
/dev/video2: ATOMISP ISP VIEWFINDER output
/dev/video3: ATOMISP ISP VIDEO output
/dev/video4: ATOMISP ACC
This way, a normal V4L2 application will get the right
device, as the first one will be the one they should use.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 29 Oct 2021 07:09:39 +0000 (08:09 +0100)]
media: atomisp: set per-device's default mode
The atomisp driver originally used the s_parm command to
initialize the run_mode type to the driver. So, before start
setting up the streaming, s_parm should be called.
So, even having 5 "normal" video devices, one meant to be used
for each type, the run_mode was actually selected when
s_parm is called.
Without setting the run mode, applications that don't call
VIDIOC_SET_PARM with a custom atomisp parameters won't work, as
the pipeline won't be set:
atomisp-isp2 0000:00:03.0: can't create streams
atomisp-isp2 0000:00:03.0: __get_frame_info 1600x1200 (padded to 0) returned -22
However, commit
8a7c5594c020 ("media: v4l2-ioctl: clear fields in s_parm")
broke support for it, with a good reason, as drivers shoudn't be
extending the API for their own purposes.
So, as an step to allow generic apps to use this driver, put
the device's run_mode in preview after open.
After this patch, using v4l2grab starts to work on preview
mode (/dev/video2):
$ v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -n 1 -u
$ feh out000.pnm
So, let's just setup the default run_mode that each video devnode
should assume, setting it at open() time.
Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 18:09:13 +0000 (18:09 +0000)]
media: atomisp: get rid of ISP2401_NEW_INPUT_SYSTEM
All ISP2401 devices use the new input system. So, get rid
of the remaining definitions, replacing them by runtime
checks for BYT/CHT when applicable.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 16:30:48 +0000 (16:30 +0000)]
media: atomisp: return errors from ia_css_dma_configure_from_info()
Now that the pipeline config functions can return errors, change
ia_css_dma_configure_from_info() and callers in order for them
to return errors at pipelines instead of using assert().
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 16:29:14 +0000 (16:29 +0000)]
media: atomisp: add return codes for pipeline config functions
Those functions can internally break, but, as they don't return
errors, internally there are some assert() calls, which is bad,
as it hangs the driver.
So, add return codes there, in preparation for removing such
assert() calls.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 13:44:34 +0000 (13:44 +0000)]
media: atomisp: sh_css_sp: better handle pipeline config errors
If something gets wrong while setup a pipeline, return an
error code.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 12:18:02 +0000 (12:18 +0000)]
media: atomisp: propagate errors at ia_css_*_configure()
Propagate the lower lever ia_css config errors to the next
level.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 12:08:37 +0000 (12:08 +0000)]
media: atomisp: cleanup ia_css_isp_configs() code
The auto-generated code inside ia_css_isp_configs() is more
complex than it should be. Also, it doesn't return any errors.
However, the functions called by it can mis-configure the pipelines,
but, as there's no way to return errors, it internally calls the
assert() macro.
So, add a return parameter to each routine there, in order to
prepare the code to be more robust.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 11:17:05 +0000 (11:17 +0000)]
media: atomisp: unify ia_css_isp_params.c
The contents of ia_css_isp_params.c is almost identical for
2400 and 2401. The only difference is that, on 2400, there
are some duplicated assignments. So, drop it, unifying this
file.
While here, simplify the Makefile's logic by dropping an
unused define.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 11:09:02 +0000 (11:09 +0000)]
media: atomisp: drop duplicated ia_css_isp_states.c
Both 2400 and 2401 have this file, but they're identical.
So, drop one of them.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 07:50:15 +0000 (07:50 +0000)]
media: atomisp: drop duplicated ia_css_isp_configs.c
Both 2400 and 2401 have this file, but they're identical.
So, drop one of them.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Fri, 5 Nov 2021 07:50:15 +0000 (07:50 +0000)]
media: atomisp: allocate a v4l2_fh at open time
This avoids an OOPS when VIDIOC_*_PRIORITY calls are used.
[ 90.820011] BUG: kernel NULL pointer dereference, address:
0000000000000020
[ 90.820021] #PF: supervisor read access in kernel mode
[ 90.820026] #PF: error_code(0x0000) - not-present page
[ 90.820030] PGD
1221bc067 P4D
1221bc067 PUD
1221bd067 PMD 0
[ 90.820042] Oops: 0000 [#1] SMP
[ 90.820048] CPU: 0 PID: 2007 Comm: qv4l2 Tainted: G C 5.15.0-rc4+ #77
[ 90.820055] Hardware name: ASUSTeK COMPUTER INC. T101HA/T101HA, BIOS T101HA.306 04/23/2019
[ 90.820059] RIP: 0010:v4l2_prio_change+0xf/0x40 [videodev]
[ 90.820096] Code: 48 8b 47 20 8b 40 44 25 ff ff 0f 00 48 8b 04 c5 20 58 44 c0 c3 66 0f 1f 44 00 00 0f 1f 44 00 00 8d 42 ff 83 f8 02 77 21 31 c0 <39> 16 74 20 8d 02 f0 ff 04 87 8b 06 89 c1 83 e9 01 83 f9 02 77 04
[ 90.820103] RSP: 0018:
ffffb348c142fd70 EFLAGS:
00010246
[ 90.820109] RAX:
0000000000000000 RBX:
ffff95575fbe2760 RCX:
ffffb348c142fe48
[ 90.820114] RDX:
0000000000000002 RSI:
0000000000000020 RDI:
ffff955740996088
[ 90.820118] RBP:
0000000040045644 R08:
ffffffffc070da80 R09:
0000000000004000
[ 90.820122] R10:
0000000000000000 R11:
0000000000000000 R12:
ffff955766725300
[ 90.820126] R13:
0000000000000000 R14:
0000000000000000 R15:
0000000000000044
[ 90.820131] FS:
00007f848526b900(0000) GS:
ffff9557bbe00000(0000) knlGS:
0000000000000000
[ 90.820137] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 90.820141] CR2:
0000000000000020 CR3:
00000001221bf000 CR4:
00000000001006f0
[ 90.820146] Call Trace:
[ 90.820155] __video_do_ioctl+0x37d/0x3b0 [videodev]
[ 90.820189] video_usercopy+0x188/0x7a0 [videodev]
[ 90.820218] ? v4l_print_control+0x20/0x20 [videodev]
[ 90.820247] ? swake_up_one+0x39/0x70
[ 90.820258] ? rcu_core+0xff/0x2e0
[ 90.820267] ? sched_clock_cpu+0x9/0xa0
[ 90.820275] ? irqtime_account_irq+0x38/0xb0
[ 90.820282] v4l2_ioctl+0x46/0x50 [videodev]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 4 Nov 2021 14:29:34 +0000 (14:29 +0000)]
media: atomisp-mt9m114: use v4l2_find_nearest_size()
Instead of reinventing the wheel, use v4l2_find_nearest_size()
in order to get the closest resolution.
This should address a bug where the wrong resolution was
selected.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 4 Nov 2021 13:57:35 +0000 (13:57 +0000)]
media: atomisp-gc2235: use v4l2_find_nearest_size()
Instead of reinventing the wheel, use v4l2_find_nearest_size()
in order to get the closest resolution.
This should address a bug where the wrong resolution was
selected.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 4 Nov 2021 13:47:34 +0000 (13:47 +0000)]
media: atomisp-gc0310: use v4l2_find_nearest_size()
Instead of reinventing the wheel, use v4l2_find_nearest_size()
in order to get the closest resolution.
This should address a bug where the wrong resolution was
selected.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Thu, 4 Nov 2021 13:17:50 +0000 (13:17 +0000)]
media: atomisp-ov2722: use v4l2_find_nearest_size()
Instead of reinventing the wheel, use v4l2_find_nearest_size()
in order to get the closest resolution.
This should address a bug where the wrong resolution was
selected.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mauro Carvalho Chehab [Wed, 3 Nov 2021 15:58:39 +0000 (15:58 +0000)]
media: atomisp-ov2680: use v4l2_find_nearest_size()
Instead of reinventing the wheel, use v4l2_find_nearest_size()
in order to get the closest resolution.
This should address a bug where the wrong resolution was
selected.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>