linux-2.6-microblaze.git
7 months agomedia: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity
Zhipeng Lu [Thu, 1 Feb 2024 12:48:44 +0000 (20:48 +0800)]
media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity

The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity
but isn't freed in its following error-handling paths. This patch
adds such deallocation to prevent memleak of entity->name.

Fixes: be2fff656322 ("media: add helpers for memory-to-memory media controller")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: v4l2-tpg: fix some memleaks in tpg_alloc
Zhipeng Lu [Thu, 1 Feb 2024 12:47:53 +0000 (20:47 +0800)]
media: v4l2-tpg: fix some memleaks in tpg_alloc

In tpg_alloc, resources should be deallocated in each and every
error-handling paths, since they are allocated in for statements.
Otherwise there would be memleaks because tpg_free is called only when
tpg_alloc return 0.

Fixes: 63881df94d3e ("[media] vivid: add the Test Pattern Generator")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agoMAINTAINERS: Add entry for Samsung MFC DT Schema
Aakarsh Jain [Wed, 31 Jan 2024 07:07:41 +0000 (12:37 +0530)]
MAINTAINERS: Add entry for Samsung MFC DT Schema

Add device tree schema entry for Samsung MFC.

Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: staging: meson: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:15 +0000 (23:16 +0000)]
media: staging: meson: Fix kerneldoc

Remove documentation from missing field.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: dvb-usb: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:13 +0000 (23:16 +0000)]
media: dvb-usb: Fix kerneldoc

Remove kerneldoc from missing fields.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: samsung: s5p-mfc: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:12 +0000 (23:16 +0000)]
media: samsung: s5p-mfc: Fix kerneldoc

Remove doc from missing fields.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: samsung: exynos4-is: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:11 +0000 (23:16 +0000)]
media: samsung: exynos4-is: Fix kerneldoc

Remove doc from missing fields.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: qcom: venus: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:10 +0000 (23:16 +0000)]
media: qcom: venus: Fix kerneldoc

Remove doc for missing field.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: verisilicon: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:09 +0000 (23:16 +0000)]
media: verisilicon: Fix kerneldoc

The field is not part of the structure. Remove the doc.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: mediatek: vcodec: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:08 +0000 (23:16 +0000)]
media: mediatek: vcodec: Fix kerneldoc

Those fields have been removed. They do not need to be documented.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: mediatek: jpeg: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:07 +0000 (23:16 +0000)]
media: mediatek: jpeg: Fix kerneldoc

The field is gone, remove the documentation for it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: i2c: adv748: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:06 +0000 (23:16 +0000)]
media: i2c: adv748: Fix kerneldoc

The field is gone, remove the documentation.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: i2c: css-quirk.h: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:05 +0000 (23:16 +0000)]
media: i2c: css-quirk.h: Fix kerneldoc

Kerneldoc does not seem to understand that embed doc:
drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'write' description in 'ccs_quirk'
drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'reg' description in 'ccs_quirk'
drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Excess struct member 'val' description in 'ccs_quirk'

Convert into a standard doc.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: pci: dt315.h: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:04 +0000 (23:16 +0000)]
media: pci: dt315.h: Fix kerneldoc

The field is gone, remove it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: cec.h: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:03 +0000 (23:16 +0000)]
media: cec.h: Fix kerneldoc

The fields are gone, remove their documentation.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: videodev2.h: Fix kerneldoc
Ricardo Ribalda [Fri, 26 Jan 2024 23:16:01 +0000 (23:16 +0000)]
media: videodev2.h: Fix kerneldoc

Named nested unions need their prefix:
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#nested-structs-unions

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: cec: core: remove length check of Timer Status
Nini Song [Thu, 25 Jan 2024 13:28:45 +0000 (21:28 +0800)]
media: cec: core: remove length check of Timer Status

The valid_la is used to check the length requirements,
including special cases of Timer Status. If the length is
shorter than 5, that means no Duration Available is returned,
the message will be forced to be invalid.

However, the description of Duration Available in the spec
is that this parameter may be returned when these cases, or
that it can be optionally return when these cases. The key
words in the spec description are flexible choices.

Remove the special length check of Timer Status to fit the
spec which is not compulsory about that.

Signed-off-by: Nini Song <nini.song@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: v4l2-ctrls: show all owned controls in log_status
Hans Verkuil [Wed, 17 Jan 2024 14:52:04 +0000 (15:52 +0100)]
media: v4l2-ctrls: show all owned controls in log_status

VIDIOC_LOG_STATUS will log the controls owned by the driver. But the
code didn't take into account the case where a single driver creates
multiple control handlers. A good example is the vivid driver, but
others use it as well.

Modify v4l2_ctrl_handler_log_status() so that it really shows all
controls owned by this driver.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: cx231xx: controls are from another device, mark this
Hans Verkuil [Wed, 17 Jan 2024 11:44:03 +0000 (12:44 +0100)]
media: cx231xx: controls are from another device, mark this

The last argument of v4l2_ctrl_add_handler() indicates whether the controls
you add are from a control handler owned by another driver (true) or from
the same driver (false). In this case the last argument was incorrectly set
to false. The controls come from the cx25840 subdev.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: em28xx: annotate unchecked call to media_device_register()
Nikita Zhandarovich [Fri, 12 Jan 2024 13:42:26 +0000 (05:42 -0800)]
media: em28xx: annotate unchecked call to media_device_register()

Static analyzers generate alerts for an unchecked call to
`media_device_register()`. However, in this case, the device will work
reliably without the media controller API.

Add a comment above the call to prevent future unnecessary changes.

Suggested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: videobuf2: Fix doc comment
Andrzej Pietrasiewicz [Fri, 5 Jan 2024 12:54:37 +0000 (13:54 +0100)]
media: videobuf2: Fix doc comment

The documented struct member is called "planes" rather than "vb2_plane".
While at it, make the comments order follow struct members order.

Fixes: 2b1413245550 ("media: vb2-core: Improve kernel-doc markups")
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: adv7180: Fix cppcheck errors
Bhavin Sharma [Tue, 2 Jan 2024 14:06:40 +0000 (19:36 +0530)]
media: adv7180: Fix cppcheck errors

ERROR: else should follow close brace '}'

Signed-off-by: Bhavin Sharma <bhavin.sharma@siliconsignals.io>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: xc4000: Fix atomicity violation in xc4000_get_frequency
Gui-Dong Han [Fri, 22 Dec 2023 05:50:30 +0000 (13:50 +0800)]
media: xc4000: Fix atomicity violation in xc4000_get_frequency

In xc4000_get_frequency():
*freq = priv->freq_hz + priv->freq_offset;
The code accesses priv->freq_hz and priv->freq_offset without holding any
lock.

In xc4000_set_params():
// Code that updates priv->freq_hz and priv->freq_offset
...

xc4000_get_frequency() and xc4000_set_params() may execute concurrently,
risking inconsistent reads of priv->freq_hz and priv->freq_offset. Since
these related data may update during reading, it can result in incorrect
frequency calculation, leading to atomicity violations.

This possible bug is found by an experimental static analysis tool
developed by our team, BassCheck[1]. This tool analyzes the locking APIs
to extract function pairs that can be concurrently executed, and then
analyzes the instructions in the paired functions to identify possible
concurrency bugs including data races and atomicity violations. The above
possible bug is reported when our tool analyzes the source code of
Linux 6.2.

To address this issue, it is proposed to add a mutex lock pair in
xc4000_get_frequency() to ensure atomicity. With this patch applied, our
tool no longer reports the possible bug, with the kernel configuration
allyesconfig for x86_64. Due to the lack of associated hardware, we cannot
test the patch in runtime testing, and just verify it according to the
code logic.

[1] https://sites.google.com/view/basscheck/

Fixes: 4c07e32884ab ("[media] xc4000: Fix get_frequency()")
Cc: stable@vger.kernel.org
Reported-by: BassCheck <bass@buaa.edu.cn>
Signed-off-by: Gui-Dong Han <2045gemini@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: verisilicon: Fix some typos
renjun wang [Sat, 16 Dec 2023 04:18:05 +0000 (12:18 +0800)]
media: verisilicon: Fix some typos

Function hantro_g1_h264_dec_prepare_table() does not exist,
should be replaced with hantro_h264_dec_init().

The register name av1_ulticore_tile_col confused sometimes,
although not be used corrently. The correct name should be
av1_multicore_tile_col.

Signed-off-by: renjun wang <renjunw0@foxmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: vidioc-subdev-g-client-cap.rst: document struct v4l2_subdev_client_capability
Hans Verkuil [Fri, 15 Dec 2023 09:38:29 +0000 (10:38 +0100)]
media: vidioc-subdev-g-client-cap.rst: document struct v4l2_subdev_client_capability

The struct v4l2_subdev_client_capability was never actually documented,
only the capability flags were documented.

Add this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: pci: cx23885: check cx23885_vdev_init() return
Hans Verkuil [Thu, 19 Oct 2023 06:58:49 +0000 (08:58 +0200)]
media: pci: cx23885: check cx23885_vdev_init() return

cx23885_vdev_init() can return a NULL pointer, but that pointer
is used in the next line without a check.

Add a NULL pointer check and go to the error unwind if it is NULL.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Sicong Huang <huangsicong@iie.ac.cn>
7 months agomedia: tc358746: fix the pll calculating function
Duc-Long, Le [Sun, 15 Oct 2023 00:19:46 +0000 (20:19 -0400)]
media: tc358746: fix the pll calculating function

Following formula of Pll_clk in 5.2 section, 50th page of
TC358746AXBG/748XBG/748IXBG Functional Specification Rev 1.1 document.
The formula of fout is as below:
fout = refclk * mul / (prediv * postdiv)

Remove "p" to avoid using 2 times of prediv in pll calculating function.

Signed-off-by: Duc-Long, Le <duclong.linux@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
7 months agomedia: ov08x40: Reduce start streaming time
Jason Chen [Wed, 24 Jan 2024 14:43:01 +0000 (15:43 +0100)]
media: ov08x40: Reduce start streaming time

Because video duration involves calculating the streaming time, and i2c
communication incurs too many XTALK register settings every 4 bytes with
i2c START and STOP.

So we have opted switch to the i2c burst method.
This method involves writing the XTALK registers in the order of
the register block.

The start streaming time can be reduced from around 400ms to 150ms

[Sakari Ailus: Drop unneeded dev_dbg().]

Signed-off-by: Jason Chen <jason.z.chen@intel.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: ov08x40: Modify the tline calculation in different modes
Jason Chen [Wed, 18 Oct 2023 05:58:41 +0000 (07:58 +0200)]
media: ov08x40: Modify the tline calculation in different modes

ov08x40 quad bayer sensor ISP has the following work modes:
- normal mode: full size
- 2x2 binned mode: binning size

In normal and binned modes, different tline calculations are
applied.

- normal mode: Tline value needs to be doubled as per the
vendor's update.

Tline time = 2 * HTS / SCLK
Exposure unit : 1 * HTS = 0.5 Tline

- 2x2 binned mode:

Tline time = 1 * HTS / SCLK
Exposure unit : 1 * HTS = 1 Tline

Signed-off-by: Jason Chen <jason.z.chen@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: ov08x40: Avoid sensor probing in D0 state
Jason Chen [Mon, 22 Jan 2024 02:54:34 +0000 (03:54 +0100)]
media: ov08x40: Avoid sensor probing in D0 state

When the system enters the D0 state and attempt to probe the device,
another component, such as LED, will also be pulled high due to the
hardware design. It's advisable to keep the device being probed in
a different D state.

Signed-off-by: Jason Chen <jason.z.chen@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: imx355: Use v4l2_link_freq_to_bitmap helper
Sakari Ailus [Mon, 8 Jan 2024 15:18:05 +0000 (16:18 +0100)]
media: imx355: Use v4l2_link_freq_to_bitmap helper

Use the v4l2_link_freq_to_bitmap() helper to figure out which
driver-supported link freq can be used on a given system.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: imx319: Use v4l2_link_freq_to_bitmap helper
Sakari Ailus [Mon, 8 Jan 2024 15:18:04 +0000 (16:18 +0100)]
media: imx319: Use v4l2_link_freq_to_bitmap helper

Use the v4l2_link_freq_to_bitmap() helper to figure out which
driver-supported link freq can be used on a given system.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: imx334: Use v4l2_link_freq_to_bitmap helper
Sakari Ailus [Mon, 8 Jan 2024 15:18:03 +0000 (16:18 +0100)]
media: imx334: Use v4l2_link_freq_to_bitmap helper

Use the v4l2_link_freq_to_bitmap() helper to figure out which
driver-supported link frequencies can be used on a given system.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: v4l: Add a helper for setting up link-frequencies control
Sakari Ailus [Mon, 8 Jan 2024 15:18:02 +0000 (16:18 +0100)]
media: v4l: Add a helper for setting up link-frequencies control

Add a helper for obtaining supported link frequencies in form most drivers
need them. The result is a bitmap of supported controls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: isl7998x: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:09:10 +0000 (04:09 +0100)]
media: i2c: isl7998x: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: max2175: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:10:24 +0000 (04:10 +0100)]
media: i2c: max2175: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: tvp5150: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:11:34 +0000 (04:11 +0100)]
media: i2c: tvp5150: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: mt9v032: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:11:05 +0000 (04:11 +0100)]
media: i2c: mt9v032: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: imx274: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:08:25 +0000 (04:08 +0100)]
media: i2c: imx274: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: imx214: convert to use maple tree register cache
Bo Liu [Wed, 17 Jan 2024 03:07:30 +0000 (04:07 +0100)]
media: i2c: imx214: convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: imx415: Add more clock configurations
Alexander Stein [Wed, 17 Jan 2024 07:39:36 +0000 (08:39 +0100)]
media: i2c: imx415: Add more clock configurations

Complete the list from "INCK Setting" section in IMX415-AAQR-C
(Rev. E19504, 2019/05/21). For consistency suffix all lane rate values by
UL, which is needed for 2376000000 anyway.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: imx415: Convert to new CCI register access helpers
Alexander Stein [Wed, 17 Jan 2024 07:39:35 +0000 (08:39 +0100)]
media: i2c: imx415: Convert to new CCI register access helpers

Use the new common CCI register access helpers to replace the private
register access helpers in the imx415 driver.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: v4l2: cci: print leading 0 on error
Julien Massot [Thu, 11 Jan 2024 13:20:03 +0000 (14:20 +0100)]
media: v4l2: cci: print leading 0 on error

In some error cases leading '0' for register address
were missing.

Fixes: 613cbb91e9ce ("media: Add MIPI CCI register access helper functions")
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: i2c: st-vgxy61: Convert to CCI register access helpers
Julien Massot [Fri, 12 Jan 2024 09:52:28 +0000 (10:52 +0100)]
media: i2c: st-vgxy61: Convert to CCI register access helpers

Use the new common CCI register access helpers to replace the private
register access helpers in the st-vgxy61 driver. This simplifies the
driver by reducing the amount of code.

st-vgxy61 devices use little endianness arrangement, therefore
the driver uses the CCI_REGx_LE registers definition.

Signed-off-by: Julien Massot <julien.massot@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: tc358743: register v4l2 async device only after successful setup
Alexander Stein [Wed, 10 Jan 2024 09:01:11 +0000 (10:01 +0100)]
media: tc358743: register v4l2 async device only after successful setup

Ensure the device has been setup correctly before registering the v4l2
async device, thus allowing userspace to access.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Fixes: 4c5211a10039 ("[media] tc358743: register v4l2 asynchronous subdevice")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: Documentation: Rework CCS driver documentation
Sakari Ailus [Fri, 5 Jan 2024 10:59:22 +0000 (11:59 +0100)]
media: Documentation: Rework CCS driver documentation

Drop duplicated UAPI specific portions of the CCS (kernel) documentation
and fix a spelling error in UAPI documentation previously fixed in driver
documentation.

Also add references both ways.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: arm64: dts: st: add video encoder support to stm32mp255
Hugues Fruchet [Wed, 10 Jan 2024 10:46:42 +0000 (11:46 +0100)]
media: arm64: dts: st: add video encoder support to stm32mp255

Add VENC hardware video encoder support to STM32MP255.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: arm64: dts: st: add video decoder support to stm32mp255
Hugues Fruchet [Wed, 10 Jan 2024 10:46:41 +0000 (11:46 +0100)]
media: arm64: dts: st: add video decoder support to stm32mp255

Add VDEC hardware video decoder support to STM32MP255.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: hantro: add support for STM32MP25 VENC
Hugues Fruchet [Wed, 10 Jan 2024 10:46:40 +0000 (11:46 +0100)]
media: hantro: add support for STM32MP25 VENC

Add support for STM32MP25 VENC video hardware encoder.
Support of JPEG encoding.
VENC has its own reset/clock/irq.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: hantro: add support for STM32MP25 VDEC
Hugues Fruchet [Wed, 10 Jan 2024 10:46:39 +0000 (11:46 +0100)]
media: hantro: add support for STM32MP25 VDEC

Add support for STM32MP25 VDEC video hardware decoder.
Support of H264/VP8 decoding.
No post-processor support.
VDEC has its own reset/clock/irq.

Successfully tested up to full HD.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: dt-bindings: media: Document STM32MP25 VDEC & VENC video codecs
Hugues Fruchet [Wed, 10 Jan 2024 10:46:38 +0000 (11:46 +0100)]
media: dt-bindings: media: Document STM32MP25 VDEC & VENC video codecs

Add STM32MP25 VDEC video decoder & VENC video encoder bindings.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add support for parallel pipe to improve FPS
Moudy Ho [Wed, 20 Dec 2023 10:18:38 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add support for parallel pipe to improve FPS

In some chips, MDP3 has the ability to utilize two pipelines to
parallelly process a single frame.
To enable this feature, multiple CMDQ clients and packets need to
be configured at the same time.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add mt8195 MDP3 component settings
Moudy Ho [Wed, 20 Dec 2023 10:18:37 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add mt8195 MDP3 component settings

Extend the component settings used in MT8195 MDP3.
Additionally, it is crucial to read all component settings in
a specific manner to ensure that shared memory data structure lengths
are aligned across different platforms.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add mt8195 shared memory configurations
Moudy Ho [Wed, 20 Dec 2023 10:18:36 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add mt8195 shared memory configurations

The configuration of the MT8195 components in the shared memory
is defined in the header file "mdp_sm_mt8195.h".

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add mt8195 platform configuration
Moudy Ho [Wed, 20 Dec 2023 10:18:35 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add mt8195 platform configuration

Add MT8195 MDP3 basic configuration in file "mdp_cfg_data.c"
and corresponding driver data.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add support for blending multiple components
Moudy Ho [Wed, 20 Dec 2023 10:18:34 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add support for blending multiple components

Certain chips can combine several components to form complex virtual
units with advanced functions.
These components require simultaneous configuration of their MODs and
clocks.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: extend GCE event waiting in RDMA and WROT
Moudy Ho [Wed, 20 Dec 2023 10:18:33 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: extend GCE event waiting in RDMA and WROT

Support for multiple RDMA/WROT waits for GCE events.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: avoid multiple driver registrations
Moudy Ho [Wed, 20 Dec 2023 10:18:32 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: avoid multiple driver registrations

The amount of MDP3 driver probes is determined by the registered
clocks of MMSYS.
Since MT8195 MDP3 utilizes VPPSYS0 and VPPSYS1, it's necessary to
prevent multiple driver registrations.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add checks for dummy components
Moudy Ho [Wed, 20 Dec 2023 10:18:31 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add checks for dummy components

Some components act as bridges only and do not require full configuration.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: introduce more MDP3 components
Moudy Ho [Wed, 20 Dec 2023 10:18:30 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: introduce more MDP3 components

Add configuration of more components in MT8195 MDP3.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: introduce more pipelines from MT8195
Moudy Ho [Wed, 20 Dec 2023 10:18:29 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: introduce more pipelines from MT8195

Increasing the number of sets built by MMSYS and MUTEX in MT8195
will enable the creation of more pipelines in MDP3.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add support second sets of MUTEX
Moudy Ho [Wed, 20 Dec 2023 10:18:28 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add support second sets of MUTEX

After setting up the second set of MMSYS (VPPSYS1), it is necessary
to have a corresponding second set of MUTEX (MUTEX2) to assist in
handling SOF/EOF.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: platform: mtk-mdp3: add support second sets of MMSYS
Moudy Ho [Wed, 20 Dec 2023 10:18:27 +0000 (11:18 +0100)]
media: platform: mtk-mdp3: add support second sets of MMSYS

The MT8195 chipset features two MMSYS subsets: VPPSYS0 and VPPSYS1.
These subsets coordinate and control the clock, power, and
register settings required for the components of MDP3.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Update TODO
Hans de Goede [Sun, 31 Dec 2023 10:00:21 +0000 (11:00 +0100)]
media: atomisp: Update TODO

Remove the TODO items for using the main (drivers/media/i2c) ov2680 and
ov5693 drivers and removing the atomisp specific ones, this has been done.

Remove the TODO item for gracefully handling missing firmware the
"media: atomisp: Bind and do power-management without firmware" changes
have fixed this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Remove unnecessary msleep(10) from atomisp_mrfld_power() error path
Hans de Goede [Sat, 30 Dec 2023 14:37:54 +0000 (15:37 +0100)]
media: atomisp: Remove unnecessary msleep(10) from atomisp_mrfld_power() error path

Remove unnecessary msleep(10) from atomisp_mrfld_power() error-exit path,
the success exit from atomisp_mrfld_power() happens if a test succeeds
inside the do { } while loop above the msleep().

The error-exit path with the removed msleep is only hit it the power-on is
not reflected in the iUNIT ISPSSPM0 status bits after a timeout of 50 ms.
Sleeping an extra 10 ms in the timeout path makes little sense.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Bind and do power-management without firmware
Hans de Goede [Sat, 30 Dec 2023 14:31:41 +0000 (15:31 +0100)]
media: atomisp: Bind and do power-management without firmware

The ISP needs to be turned off in a special manner for the SoC
to be able to reach S0i3 during suspend.

When the firmware is missing still bind to the PCI device and
run in pm-only mode which takes care of turning the ISP off
(including turning it off again if the firmware has turned it
on during resume).

In this new pm-only mode the atomisp driver works exactly the same
as the non-staging, pm-only drivers/platform/x86/intel/atomisp2/pm.c
driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Move power-management [un]init into atomisp_pm_[un]init()
Hans de Goede [Fri, 29 Dec 2023 22:14:20 +0000 (23:14 +0100)]
media: atomisp: Move power-management [un]init into atomisp_pm_[un]init()

Move the power-management setup and cleanup code into
atomisp_pm_[un]init() helper functions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Replace atomisp_drvfs attr with using driver.dev_groups attr
Hans de Goede [Fri, 29 Dec 2023 21:04:43 +0000 (22:04 +0100)]
media: atomisp: Replace atomisp_drvfs attr with using driver.dev_groups attr

sysfs attributes preferably should not be manually be registered but
instead the driver.groups / driver.dev_groups driver struct members
should be used to have the driver core handle this in a race free
manner.

Using driver.groups would be the most direct replacement for
driver_[add|remove]_file, but some of the attributes actually need access
to the struct atomisp_device (*), so as part of modernizing this part of
the atomisp driver this change also makes the sysfs attribute device
attributes instead of driver attributes.

*) Before this change accessing these attributes without the driver having
bound would result in a NULL pointer deref, this commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix probe()/remove() power-management
Hans de Goede [Wed, 27 Dec 2023 22:20:11 +0000 (23:20 +0100)]
media: atomisp: Fix probe()/remove() power-management

Fix probe()/remove() power-management:

-Currently the driver uses pm_runtime_put_noidle() and relies on
 userspace to open + close the /dev/video# node at least once to
 actually turn the ISP off. Replace the pm_runtime_put_noidle()
 with pm_runtime_put_sync() to make sure that the device is turned
 off without relying on userspace for this.
 This also ensures that atomisp_css_init() is run (by atomisp_power_on())
 if the first userspace process opening /dev/video# wants to do more then
 just query the v4l2-caps.
 As part of this change move the pm setup code in probe() to just before
 calling v4l2_async_nf_register() which registers the /dev/* nodes, so
 that the device is left on for the entirety of the probe() function.

-Remove the turning off of the atomisp from the exit-error path,
 the PCI subsystem and subsequent probe() attempts expect the device
 to be in the on state when probe() fails.
 This also fixes the atomisp driver causing the system to hang / freeze
 when its firmware is missing. This freeze is caused by an unidentified
 bug in the power-off on exit-error code which is now removed.

-Make sure that remove() properly powers on the device by replacing
 pm_runtime_get_noresume() with pm_runtime_get_sync. The PCI subsystem
 and subsequent probe() attempts expect the device to be in the on state
 after unbinding the driver.

-Note this also swaps the order of put()/allow() and forbid()/get()
 so that the sync versions actually work by calling allow() before put()
 and forbid() after get()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Group cpu_latency_qos_add_request() call together with other PM calls
Hans de Goede [Wed, 27 Dec 2023 22:02:40 +0000 (23:02 +0100)]
media: atomisp: Group cpu_latency_qos_add_request() call together with other PM calls

Group the cpu_latency_qos_add_request() call in probe() together with
the other PM calls in probe().

This is a preparation patch for futher PM fixes / work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix atomisp_pci_remove()
Hans de Goede [Wed, 27 Dec 2023 21:47:45 +0000 (22:47 +0100)]
media: atomisp: Fix atomisp_pci_remove()

Fix atomisp_pci_remove():
-Remove uninformative "Removing atomisp driver" log message
-Add missing devm_free_irq(), atomisp_uninitialize_modules() and
 pci_free_irq_vectors() calls
-Move atomisp_msi_irq_uninit() down so that the remove() order is
 an exact mirror of the probe() order

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix probe error-exit path
Hans de Goede [Wed, 27 Dec 2023 20:45:48 +0000 (21:45 +0100)]
media: atomisp: Fix probe error-exit path

Fix probe error-exit path:
-Add a missing ia_css_unload_firmware() call when v4l2_async_nf_register()
 fails
-Add a missing pm_runtime_forbid() call to undo the pm_runtime_allow() call
-Remove the unnecessary pcim_iounmap_regions() those are devm managed
 so they will get cleaned up automatically on an error exit from probe()
-Rename the labels to avoid having multiple labels pointing to the same
 place in the error-exit path

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Call pcim_enable_device() and pcim_iomap_regions() later
Hans de Goede [Sun, 12 Nov 2023 20:29:28 +0000 (21:29 +0100)]
media: atomisp: Call pcim_enable_device() and pcim_iomap_regions() later

ATM the atomisp firmware is not available in linux-firmware,
so most users will not have it installed.

Move pcim_enable_device() and pcim_iomap_regions() down in
atomisp_pci_probe() so that they are never called when the firmware
is not there.

This is a preparation patch for making the atomisp driver handle
missing firmware better.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Drop is_valid_device() function
Hans de Goede [Tue, 26 Dec 2023 15:32:10 +0000 (16:32 +0100)]
media: atomisp: Drop is_valid_device() function

Now that a single build supports both the ISP 2400 and the ISP 2401
this function is no longer necessary. The main probe() already
contains a similar switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK)
checking for a known device_id.

Move the revision check into the main probe() and drop
the is_valid_device() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Remove remaining deferred firmware loading code
Hans de Goede [Fri, 10 Nov 2023 16:48:48 +0000 (17:48 +0100)]
media: atomisp: Remove remaining deferred firmware loading code

There is a bunch of dead code left from the deferred firmware loading
support which was removed in commit 8972ed6ea7a0 ("media: atomisp: Remove
deferred firmware loading support").

Remove this dead code:
- Remove the skip_fwload module parameter
- Remove the now always NULL fw argument from ia_css_init()
- Remove the fw_explicitly_loaded boolean from sh_css.c
  (this was always true now)
- Adjust some function kernel-doc comments to match

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Remove s_routing subdev call
Hans de Goede [Thu, 28 Dec 2023 20:28:07 +0000 (21:28 +0100)]
media: atomisp: Remove s_routing subdev call

sensor drivers do not implement the s_routing subdev call, so there is
no use in calling it.

Also the 3 0 arguments are not the arguments which a successful
s_routing call is supposed to take.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistake in ia_css_acc_types.h
Dipendra Khadka [Sat, 23 Dec 2023 14:11:57 +0000 (15:11 +0100)]
media: atomisp: Fix spelling mistake in ia_css_acc_types.h

codespell reported spelling mistakes in
ia_css_acc_types.h as below:

'''
ia_css_acc_types.h:87: cummulative ==> cumulative
ia_css_acc_types.h:411: descibes ==> describes
'''

This patch fixes these spelling mistakes.
Word "cummulative" is changed to "accumulation"
and "descibes" to "describes".

Link: https://lore.kernel.org/r/20231223141157.95501-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistake in binary.c
Dipendra Khadka [Sat, 23 Dec 2023 09:15:21 +0000 (10:15 +0100)]
media: atomisp: Fix spelling mistake in binary.c

codespell reported following spelling mistake
in runtime/binary/src as below:

'''
./runtime/binary/src/binary.c:537: spcification ==> specification
'''
This patch fixes thisspelling mistake.

Link: https://lore.kernel.org/r/20231223091521.85467-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in ia_css_hdr_types.h
Dipendra Khadka [Sat, 23 Dec 2023 08:31:57 +0000 (09:31 +0100)]
media: atomisp: Fix spelling mistakes in ia_css_hdr_types.h

codespell reported following spelling mistake
in ia_css_hdr_types.h below:

'''
./isp/kernels/hdr/ia_css_hdr_types.h:60: paramterers ==> parameters
./isp/kernels/hdr/ia_css_hdr_types.h:62: Currenly ==> Currently
'''
This patch fixes these spelling mistakes.

Link: https://lore.kernel.org/r/20231223083157.84090-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in ia_css_macc_table.host.c
Dipendra Khadka [Sat, 23 Dec 2023 08:13:54 +0000 (09:13 +0100)]
media: atomisp: Fix spelling mistakes in ia_css_macc_table.host.c

codespell reported following spelling mistake
in ia_css_macc_table.host.c below:

'''
./isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c:22: matix ==> matrix
./isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c:39: matix ==> matrix
'''
This patch fixes these spelling mistakes.

Link: https://lore.kernel.org/r/20231223081354.83318-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in rmgr_vbuf.c
Dipendra Khadka [Sat, 23 Dec 2023 07:22:45 +0000 (08:22 +0100)]
media: atomisp: Fix spelling mistakes in rmgr_vbuf.c

codespell reported following spelling mistake
in rmgr_vbuf.cas below:

'''
./runtime/rmgr/src/rmgr_vbuf.c:201: succes ==> success
./runtime/rmgr/src/rmgr_vbuf.c:211: succes ==> success
./runtime/rmgr/src/rmgr_vbuf.c:215: succes ==> success
'''
This patch fixes these spelling mistakes.
It is good to use variable name that gives
proper meaning and spelling error free.

Link: https://lore.kernel.org/r/20231223072245.81630-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in queue.c
Dipendra Khadka [Sat, 23 Dec 2023 07:11:57 +0000 (08:11 +0100)]
media: atomisp: Fix spelling mistakes in queue.c

codespell reported following spelling mistake
in queue.c as below:

'''
./runtime/queue/src/queue.c:126: uncessary ==> unnecessary
./runtime/queue/src/queue.c:183: uncessary ==> unnecessary
'''
This patch fixes these spelling mistakes.

Link: https://lore.kernel.org/r/20231223071157.81082-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in sh_css_mipi.c
Dipendra Khadka [Sat, 23 Dec 2023 06:41:52 +0000 (07:41 +0100)]
media: atomisp: Fix spelling mistakes in sh_css_mipi.c

codespell reported following spelling mistake
in sh_css_mipi.c as below:

'''
./sh_css_mipi.c:177: separatelly ==> separately
./sh_css_mipi.c:540: ofset ==> offset, of set
'''
This patch fixes these spelling mistakes by changing
"separatelly" to "separately" and "ofset" to "offset".

Link: https://lore.kernel.org/r/20231223064152.79712-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistake in ia_css_circbuf.h
Dipendra Khadka [Sat, 23 Dec 2023 06:16:47 +0000 (07:16 +0100)]
media: atomisp: Fix spelling mistake in ia_css_circbuf.h

codespell reported following spelling mistake
in ia_css_circbuf.h as below:

'''
./base/circbuf/interface/ia_css_circbuf.h:76: poistion ==> position
'''
This patch fixes this spelling mistake.

Link: https://lore.kernel.org/r/20231223061647.78669-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in circbuf.c
Dipendra Khadka [Sat, 23 Dec 2023 06:04:22 +0000 (07:04 +0100)]
media: atomisp: Fix spelling mistakes in circbuf.c

codespell reported following spelling mistakes
in circbuf.c as below:

'''
./circbuf.c:27: whehter ==> whether
./circbuf.c:132: offest ==> offset
'''
This patch fixes these spelling mistakes.

Link: https://lore.kernel.org/r/20231223060422.77789-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistake in isp2400_input_system_global.h
Dipendra Khadka [Fri, 22 Dec 2023 20:15:03 +0000 (21:15 +0100)]
media: atomisp: Fix spelling mistake in isp2400_input_system_global.h

The script checkpatch.pl reported a spelling error
in isp2400_input_system_global.h as below:

'''
WARNING: 'upto' may be misspelled - perhaps 'up to'?
//MIPI allows upto 4 channels.
              ^^^^
'''

This patch corrects a spelling error,
changing "upto" to "up to".

Link: https://lore.kernel.org/r/20231222201503.2337-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix repeated "of" in isp2400_input_system_public.h
Dipendra Khadka [Fri, 22 Dec 2023 19:40:35 +0000 (20:40 +0100)]
media: atomisp: Fix repeated "of" in isp2400_input_system_public.h

The script checkpatch.pl reported repeated
word 'of' in isp2400_input_system_public.h
as below:

'''
WARNING: Possible repeated word: 'of'
/*! Read from a control register PORT[port_ID] of of RECEIVER[ID]
'''

This patch removes one 'of'.

Link: https://lore.kernel.org/r/20231222194036.1984-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Remove redundant assignments to variables
Colin Ian King [Tue, 19 Dec 2023 14:39:29 +0000 (15:39 +0100)]
media: atomisp: Remove redundant assignments to variables

There are several variables that are being initialized with values
that are never read, the assignment are redundant and can be removed.
Cleans up cppcheck unreadVariable warnings.

Link: https://lore.kernel.org/r/20231219143929.367929-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix a spelling mistake in sh_css_defs.h
Dipendra Khadka [Mon, 18 Dec 2023 15:32:00 +0000 (16:32 +0100)]
media: atomisp: Fix a spelling mistake in sh_css_defs.h

The script checkpatch.pl reported a spelling error
in sh_css_defs.h as below:

'''
WARNING: 'upto' may be misspelled - perhaps 'up to'?
/* The FPGA system (vec_nelems == 16) only supports upto 5MP */
                                                    ^^^^
'''

This patch corrects a spelling error,
changing "upto" to "up to".

Link: https://lore.kernel.org/r/20231218153200.450148-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Fix spelling mistakes in ia_css_irq.h
Dipendra Khadka [Mon, 18 Dec 2023 15:17:04 +0000 (16:17 +0100)]
media: atomisp: Fix spelling mistakes in ia_css_irq.h

The script checkpatch.pl reported spelling errors
in ia_css_irq.h as below:

'''
WARNING: Possible repeated word: 'in'
        /** the input system in in error */

WARNING: Possible repeated word: 'in'
        /** the input formatter in in error */

WARNING: Possible repeated word: 'in'
        /** the dma in in error */
'''

This patch corrects spelling errors,
changing "in" to "is" in all three comments.

Link: https://lore.kernel.org/r/20231218151704.449883-1-kdipendra88@gmail.com
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Removed duplicate comment and fixed comment format
Jonathan Bergh [Sat, 14 Oct 2023 08:35:45 +0000 (10:35 +0200)]
media: atomisp: Removed duplicate comment and fixed comment format

Fixed the following issues:
 * Removed a duplicate comment
 * Fixed up minor comment format issue

Link: https://lore.kernel.org/r/20231014083545.173238-1-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Refactor sensor crop + fmt setting
Hans de Goede [Fri, 29 Dec 2023 15:41:55 +0000 (16:41 +0100)]
media: atomisp: Refactor sensor crop + fmt setting

There are 3 code-paths all of 3 which need to do:

1. Get try or active state
2. lock state
3. Call atomisp_set_crop()
4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt)
5. unlock state

Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of
this and change the 3 code-paths which need this to use the new
atomisp_set_crop_and_fmt() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agomedia: atomisp: Adjust for v4l2_subdev_state handling changes in 6.8
Hans de Goede [Thu, 28 Dec 2023 21:43:25 +0000 (22:43 +0100)]
media: atomisp: Adjust for v4l2_subdev_state handling changes in 6.8

The atomisp driver emulates a standard v4l2 device, which also works
for non media-controller aware applications.

Part of this requires making try_fmt calls on the sensor when
a normal v4l2 app is making try_fmt calls on the /dev/video# mode.

With the recent v4l2_subdev_state handling changes in 6.8 this no longer
works, fixing this requires 2 changes:

1. The atomisp code was using its own internal v4l2_subdev_pad_config
   for this. Replace the internal v4l2_subdev_pad_config with allocating
   a full v4l2_subdev_state for storing the full try_fmt state.

2. The paths actually setting the fmt or crop selection now need to be
   passed the v4l2_subdev's active state, so that sensor drivers which
   are using the v4l2_subdev's active state to store their state keep
   working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
7 months agoMerge tag 'v6.8-rc2'
Hans Verkuil [Mon, 29 Jan 2024 07:59:23 +0000 (08:59 +0100)]
Merge tag 'v6.8-rc2'

Linux 6.8-rc2

The vb2 fixes from v6.8-rc2 are needed for the work on the new
vb2 delete buffers feature.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
8 months agoLinux 6.8-rc2
Linus Torvalds [Mon, 29 Jan 2024 01:01:12 +0000 (17:01 -0800)]
Linux 6.8-rc2

8 months agoMerge tag 'cxl-fixes-6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Linus Torvalds [Sun, 28 Jan 2024 21:55:56 +0000 (13:55 -0800)]
Merge tag 'cxl-fixes-6.8-rc2' of git://git./linux/kernel/git/cxl/cxl

Pull cxl fixes from Dan Williams:
 "A build regression fix, a device compatibility fix, and an original
  bug preventing creation of large (16 device) interleave sets:

   - Fix unit test build regression fallout from global
     "missing-prototypes" change

   - Fix compatibility with devices that do not support interrupts

   - Fix overflow when calculating the capacity of large interleave sets"

* tag 'cxl-fixes-6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
  cxl/region:Fix overflow issue in alloc_hpa()
  cxl/pci: Skip irq features if MSI/MSI-X are not supported
  tools/testing/nvdimm: Disable "missing prototypes / declarations" warnings
  tools/testing/cxl: Disable "missing prototypes / declarations" warnings

8 months agoMerge tag 'mips-fixes_6.8_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips...
Linus Torvalds [Sun, 28 Jan 2024 18:43:06 +0000 (10:43 -0800)]
Merge tag 'mips-fixes_6.8_1' of git://git./linux/kernel/git/mips/linux

Pull MIPS fixes from Thomas Bogendoerfer:

 - fix boot issue on single core Lantiq Danube devices

 - fix boot issue on Loongson64 platforms

 - fix improper FPU setup

 - fix missing prototypes issues

* tag 'mips-fixes_6.8_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
  mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
  MIPS: loongson64: set nid for reserved memblock region
  Revert "MIPS: loongson64: set nid for reserved memblock region"
  MIPS: lantiq: register smp_ops on non-smp platforms
  MIPS: loongson64: set nid for reserved memblock region
  MIPS: reserve exception vector space ONLY ONCE
  MIPS: BCM63XX: Fix missing prototypes
  MIPS: sgi-ip32: Fix missing prototypes
  MIPS: sgi-ip30: Fix missing prototypes
  MIPS: fw arc: Fix missing prototypes
  MIPS: sgi-ip27: Fix missing prototypes
  MIPS: Alchemy: Fix missing prototypes
  MIPS: Cobalt: Fix missing prototypes

8 months agoMerge tag 'locking_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 28 Jan 2024 18:38:16 +0000 (10:38 -0800)]
Merge tag 'locking_urgent_for_v6.8_rc2' of git://git./linux/kernel/git/tip/tip

Pull locking fix from Borislav Petkov:

 - Prevent an inconsistent futex operation leading to stale state
   exposure

* tag 'locking_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Prevent the reuse of stale pi_state

8 months agoMerge tag 'irq_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 28 Jan 2024 18:34:55 +0000 (10:34 -0800)]
Merge tag 'irq_urgent_for_v6.8_rc2' of git://git./linux/kernel/git/tip/tip

Pull irq fix from Borislav Petkov:

 - Initialize the resend node of each IRQ descriptor, not only the first
   one

* tag 'irq_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  genirq: Initialize resend_node hlist for all interrupt descriptors

8 months agoMerge tag 'timers_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 28 Jan 2024 18:33:14 +0000 (10:33 -0800)]
Merge tag 'timers_urgent_for_v6.8_rc2' of git://git./linux/kernel/git/tip/tip

Pull timer fixes from Borislav Petkov:

 - Preserve the number of idle calls and sleep entries across CPU
   hotplug events in order to be able to compute correct averages

 - Limit the duration of the clocksource watchdog checking interval as
   too long intervals lead to wrongly marking the TSC as unstable

* tag 'timers_urgent_for_v6.8_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick/sched: Preserve number of idle sleeps across CPU hotplug events
  clocksource: Skip watchdog check for large watchdog intervals