linux-2.6-block.git
5 months agomedia: dt-bindings: nxp,imx8-isi: Refuse port@1 for single pipeline models
Alexander Stein [Fri, 12 Apr 2024 09:55:49 +0000 (11:55 +0200)]
media: dt-bindings: nxp,imx8-isi: Refuse port@1 for single pipeline models

In case the hardware only supports just one pipeline, explicitly refuse
port@1 in ports node.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240412095549.258870-1-alexander.stein@ew.tq-group.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 months agomedia: mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events
Stefan Klug [Thu, 14 Mar 2024 09:36:50 +0000 (10:36 +0100)]
media: mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events

The Samsung CSIS MIPI receiver provides a start-of-frame interrupt and
a framecount register. As the CSI receiver is the hardware unit that lies
closest to the sensor, the frame counter is the best we can get on these
devices. In case of the ISI available on the i.MX8 M Plus it is also the
only native start-of-frame signal available.

This patch exposes the sof interrupt and the framecount as
V4L2_EVENT_FRAME_SYNC event on the subdevice.

It was tested on a Debix-Som-A with a 6.8-rc4 kernel.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Link: https://lore.kernel.org/r/20240314093652.56923-1-stefan.klug@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 months agomedia: usb: siano: Fix allocation of urbs
Ricardo Ribalda [Mon, 15 Apr 2024 12:48:13 +0000 (12:48 +0000)]
media: usb: siano: Fix allocation of urbs

USB urbs must be allocated with usb_alloc_urb. Quoting the manual

Only use this function (usb_init_urb) if you _really_ understand what you
are doing.

Fix the following smatch error:

drivers/media/usb/siano/smsusb.c:53:38: warning: array of flexible structures

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: logging
Stefan Herdler [Mon, 15 Apr 2024 02:24:11 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: logging

This patch fixes the following checkpatch warnings:

WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'ciintf_slot_ts_enable', this function's name, in a string
CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'level' may be better as '(level)' to avoid precedence issues

There was no consistent style of logging functions used so far.
Convert all logging to the appropriate pr_* macros.
Add a global pr_fmt macro for the whole driver.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: miscellaneous
Stefan Herdler [Mon, 15 Apr 2024 02:24:10 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: miscellaneous

This patch fixes the following checkpatch warnings:

WARNING:RETURN_VOID: void function return statements are not generally useful
WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: constant_comparsation
Stefan Herdler [Mon, 15 Apr 2024 02:24:09 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: constant_comparsation

This patch fixes the following checkpatch warnings:

WARNING:CONSTANT_COMPARISON: Comparisons should place the constant on the right side of the test

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: trailing_statements
Stefan Herdler [Mon, 15 Apr 2024 02:24:08 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: trailing_statements

This patch fixes the following checkpatch errors:

ERROR:TRAILING_STATEMENTS: trailing statements should be on next line

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: assign_in_if
Stefan Herdler [Mon, 15 Apr 2024 02:24:07 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: assign_in_if

This patch fixes the following checkpatch errors:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: export_symbol
Stefan Herdler [Mon, 15 Apr 2024 02:24:06 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: export_symbol

This patch fixes the following checkpatch warnings:

WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: braces
Stefan Herdler [Mon, 15 Apr 2024 02:24:05 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: braces

This patch fixes the following checkpatch warnings and errors:

WARNING:BRACES: braces {} are not necessary for any arm of this statement
WARNING:BRACES: braces {} are not necessary for single statement blocks
ERROR:OPEN_BRACE: that open brace { should be on the previous line
CHECK:BRACES: braces {} should be used on all arms of this statement
CHECK:BRACES: Unbalanced braces around else statement

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: comments
Stefan Herdler [Mon, 15 Apr 2024 02:24:04 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: comments

This patch fixes the following checkpatch warnings:

WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines
WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
WARNING: It's generally not useful to have the filename in the file

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: whitespace
Stefan Herdler [Mon, 15 Apr 2024 02:24:03 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: whitespace

It fixes the following checkpatch errors:

ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
ERROR:SPACING: space required after that ',' (ctx:VxV)
ERROR:SWITCH_CASE_INDENT_LEVEL: switch and case should be at the same indent

This patch contains the large multi line blocks.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ttpci: coding style fixes: whitespace and newlines
Stefan Herdler [Mon, 15 Apr 2024 02:24:02 +0000 (04:24 +0200)]
media: ttpci: coding style fixes: whitespace and newlines

This patch fixes the following checkpatch warnings and errors:

ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar"
ERROR:SPACING: space prohibited after that open parenthesis '('
ERROR:SPACING: space prohibited before that close parenthesis ')'
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
ERROR:SPACING: space required after that ',' (ctx:VxV)
ERROR:SPACING: space required before that '-' (ctx:OxV)
ERROR:SPACING: space required before the open parenthesis '('
ERROR:SPACING: spaces required around that '!=' (ctx:VxO)
ERROR:SPACING: spaces required around that '<' (ctx:VxV)
ERROR:SPACING: spaces required around that '=' (ctx:VxV)
ERROR:SPACING: spaces required around that '>=' (ctx:VxV)
WARNING:SPACING: space prohibited between function name and open parenthesis '('
WARNING:TABSTOP: Statements should start on a tabstop
WARNING:LEADING_SPACE: please, no spaces at the start of a line
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements
WARNING:LINE_SPACING: Missing a blank line after declarations

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: adv7180: Only request valids IRQs
Ricardo Ribalda [Wed, 10 Apr 2024 21:54:42 +0000 (21:54 +0000)]
media: adv7180: Only request valids IRQs

i2c_device_probe(), seems to assume that irq = 0 means that there is no
irq to request.

The driver also believes that on the clean path. So lets be consistent
here.

Also make smatch happy.

Fix:
drivers/media/i2c/adv7180.c:1526 adv7180_probe() warn: 'client->irq' from request_threaded_irq() not released on lines: 1526

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l2-ctrls-core.c: Do not use iterator outside loop
Ricardo Ribalda [Wed, 10 Apr 2024 21:54:41 +0000 (21:54 +0000)]
media: v4l2-ctrls-core.c: Do not use iterator outside loop

Simplify a bit the code introducing a new variable for iterating through
the control list.

It also makes smatch happy:

drivers/media/v4l2-core/v4l2-ctrls-api.c:1091 v4l2_query_ext_ctrl() warn: iterator used outside loop: 'ref'

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: fix tiny whitespace issue in 'pos  = ref': use just one space]

5 months agomedia: platform: sti: hva: clk_unprepare unconditionally
Ricardo Ribalda [Wed, 10 Apr 2024 21:54:40 +0000 (21:54 +0000)]
media: platform: sti: hva: clk_unprepare unconditionally

hva->clk cannot be NULL at this point. Simplify the code and make smatch
happy:

drivers/media/platform/st/sti/hva/hva-hw.c:412 hva_hw_probe() warn: 'hva->clk' from clk_prepare() not released on lines: 412

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: cxd2880: Replaze kmalloc with kzalloc
Ricardo Ribalda [Wed, 10 Apr 2024 21:54:39 +0000 (21:54 +0000)]
media: cxd2880: Replaze kmalloc with kzalloc

Fix smatch error:
drivers/media/spi/cxd2880-spi.c:391 cxd2880_start_feed() warn: Please consider using kzalloc instead of kmalloc

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dvb-usb: dib0700_devices: Add missing release_firmware()
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:56 +0000 (21:17 +0000)]
media: dvb-usb: dib0700_devices: Add missing release_firmware()

Add missing release_firmware on the error paths.

drivers/media/usb/dvb-usb/dib0700_devices.c:2415 stk9090m_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2415.
drivers/media/usb/dvb-usb/dib0700_devices.c:2497 nim9090md_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2489,2497.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dvb-frontends: drx39xyj: Refactor firmware upload
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:55 +0000 (21:17 +0000)]
media: dvb-frontends: drx39xyj: Refactor firmware upload

Do not cache the file, instead load it on demand.

This makes smatch a happy parser:
drivers/media/dvb-frontends/drx39xyj/drxj.c:11908 drx_ctrl_u_code() warn: 'fw' from request_firmware() not released on lines: 11877,11886,11896.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: tunner: xc5000: Refactor firmware load
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:54 +0000 (21:17 +0000)]
media: tunner: xc5000: Refactor firmware load

Make sure the firmware is released when we leave
xc_load_fw_and_init_tuner()

This change makes smatch happy:
drivers/media/tuners/xc5000.c:1213 xc_load_fw_and_init_tuner() warn: 'fw' from request_firmware() not released on lines: 1213.

Cc: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: c8sectpfe: Refactor load_c8sectpfe_fw
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:53 +0000 (21:17 +0000)]
media: c8sectpfe: Refactor load_c8sectpfe_fw

release_firmware() in the same function that it was requested. It is
more clear and makes smatch happy.

drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c:1146 load_c8sectpfe_fw() warn: 'fw' from request_firmware() not released on lines: 1125,1132.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: saa7134: Use devm_request_irq
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:52 +0000 (21:17 +0000)]
media: saa7134: Use devm_request_irq

The handled version of request_irq let us remove the free_irq and makes
smatch happier:

drivers/media/pci/saa7134/saa7134-alsa.c:1186 alsa_card_saa7134_create() warn: 'dev->pci->irq' from request_irq() not released on lines: 1186

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: solo6x10: Use devm functions
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:51 +0000 (21:17 +0000)]
media: solo6x10: Use devm functions

Let devm handle the life cycle of the irq request.

Makes smatch happier:

drivers/media/pci/solo6x10/solo6x10-core.c:631 solo_pci_probe() warn: 'pdev' from pci_request_regions() not released on lines: 631.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: solo6x10: Use pcim functions
Ricardo Ribalda [Thu, 11 Apr 2024 21:17:50 +0000 (21:17 +0000)]
media: solo6x10: Use pcim functions

Instead of handling manually the release of the memory regions let devm
do that for us.

Makes smatch happy:
drivers/media/pci/solo6x10/solo6x10-core.c:631 solo_pci_probe() warn: 'pdev' from pci_request_regions() not released on lines: 631.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: videodev2: Fix v4l2_ext_control packing.
Ricardo Ribalda [Wed, 10 Apr 2024 12:24:39 +0000 (12:24 +0000)]
media: videodev2: Fix v4l2_ext_control packing.

The structure is packed, which requires that all its fields need to be
also packed.

./include/uapi/linux/videodev2.h:1810:2: warning: field  within 'struct v4l2_ext_control' is less aligned than 'union v4l2_ext_control::(anonymous at ./include/uapi/linux/videodev2.h:1810:2)' and is usually due to 'struct v4l2_ext_control' being packed, which can lead to unaligned accesses [-Wunaligned-access]

Explicitly set the inner union as packed.

Marking the inner union as 'packed' does not change the layout, since the
whole struct is already packed, it just silences the clang warning. See
also this llvm discussion:

https://github.com/llvm/llvm-project/issues/55520

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dvb: Fix dtvs_stats packing.
Ricardo Ribalda [Wed, 10 Apr 2024 12:24:38 +0000 (12:24 +0000)]
media: dvb: Fix dtvs_stats packing.

The structure is packed, which requires that all its fields need to be
also packed.

./include/uapi/linux/dvb/frontend.h:854:2: warning: field  within 'struct dtv_stats' is less aligned than 'union dtv_stats::(anonymous at ./include/uapi/linux/dvb/frontend.h:854:2)' and is usually due to 'struct dtv_stats' being packed, which can lead to unaligned accesses [-Wunaligned-access]

Explicitly set the inner union as packed.

Marking the inner union as 'packed' does not change the layout, since the
whole struct is already packed, it just silences the clang warning. See
also this llvm discussion:

https://github.com/llvm/llvm-project/issues/55520

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dvb: as102-fe: Fix as10x_register_addr packing
Ricardo Ribalda [Wed, 10 Apr 2024 12:24:37 +0000 (12:24 +0000)]
media: dvb: as102-fe: Fix as10x_register_addr packing

This structure is embedded in multiple other structures that are packed,
which conflicts with it being aligned.

drivers/media/usb/as102/as10x_cmd.h:379:30: warning: field reg_addr within 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' is less aligned than 'struct as10x_register_addr' and is usually due to 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]

Mark it as being packed.

Marking the inner struct as 'packed' does not change the layout, since the
whole struct is already packed, it just silences the clang warning. See
also this llvm discussion:

https://github.com/llvm/llvm-project/issues/55520

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: c8sectpfe: Do not depend on DEBUG_FS
Ricardo Ribalda [Thu, 11 Apr 2024 12:14:03 +0000 (12:14 +0000)]
media: c8sectpfe: Do not depend on DEBUG_FS

Make dependency on DEBUG_FS conditional, that way we are not forced to
enable DEBUG_FS if we can to use this driver.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: atomisp: Implement link_setup() op for ISP subdev MC entity
Hans de Goede [Sun, 4 Feb 2024 16:01:45 +0000 (17:01 +0100)]
media: atomisp: Implement link_setup() op for ISP subdev MC entity

The atomisp driver's Android heritage makes it weird in that
even though it uses MC + subdev-s it is designed to primarily
be controlled through its /dev/video# node.

It implements s_input() on /dev/video# to select which sensor to use,
while ignoring link_setup() calls to enable a link to another sensor.

Add support for selecting the active sensor the MC way by adding
link_setup() support.

The implementation is a bit convoluted due to the atomisp driver's
heritage.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Make MC link from ISP to /dev/video# output node immutable
Hans de Goede [Sun, 4 Feb 2024 16:41:15 +0000 (17:41 +0100)]
media: atomisp: Make MC link from ISP to /dev/video# output node immutable

The link from the ISP's source pad to the /dev/video# output v4l2-dev
is always enabled and immutable, mark it as such.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Change ISP subdev name to "ATOM ISP"
Hans de Goede [Sun, 4 Feb 2024 09:50:49 +0000 (10:50 +0100)]
media: atomisp: Change ISP subdev name to "ATOM ISP"

Change the generic "ATOMISP_SUBDEV" name to "ATOM ISP" to make clear
that this is the subdev for the ISP itself.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Add DMABUF support
Hans de Goede [Fri, 2 Feb 2024 07:37:28 +0000 (08:37 +0100)]
media: atomisp: Add DMABUF support

Add DMABUF support and while at it drop userptr support.

Now that atomisp has been ported to videobuf2 this is trivial.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Stop setting sd->devnode for the ATOMISP_SUBDEV v4l2-subdev
Hans de Goede [Sun, 28 Jan 2024 12:43:30 +0000 (13:43 +0100)]
media: atomisp: Stop setting sd->devnode for the ATOMISP_SUBDEV v4l2-subdev

Stop setting sd->devnode for the ATOMISP_SUBDEV v4l2-subdev, so that
a proper /dev/v4l-subdev# gets created for it.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Remove ISP controls which get passed through to the camera
Hans de Goede [Sun, 4 Feb 2024 22:33:25 +0000 (23:33 +0100)]
media: atomisp: Remove ISP controls which get passed through to the camera

Drop all ISP controls and ioctls which just get passed through
to the camera subdev. Instead these calls should be done directly
at the sensor subdev.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Remove custom VCM handling
Hans de Goede [Sun, 4 Feb 2024 17:09:43 +0000 (18:09 +0100)]
media: atomisp: Remove custom VCM handling

Remove the custom VCM handling, instead the VCM should be controlled
through its own v4l2-subdev and the new ipu-bridge.c code already
supports instantiating an i2c_client for this and setting up
the necessary endpoints in the fwnode graph.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Rename atomisp_set_crop_and_fmt()
Hans de Goede [Sun, 4 Feb 2024 10:22:07 +0000 (11:22 +0100)]
media: atomisp: Rename atomisp_set_crop_and_fmt()

Rename atomisp_set_crop_and_fmt() to atomisp_set_sensor_crop_and_fmt()
to make clear that it operates on the sensor subdev.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Remove isp_subdev_propagate()
Hans de Goede [Sat, 3 Feb 2024 11:42:06 +0000 (12:42 +0100)]
media: atomisp: Remove isp_subdev_propagate()

isp_subdev_propagate() is a wrapper around atomisp_subdev_set_selection()
which gets only used in a single place.

Call atomisp_subdev_set_selection() directly in that single place instead.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries
Zhipeng Lu [Thu, 18 Jan 2024 15:13:00 +0000 (16:13 +0100)]
media: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries

The allocation failure of mycs->yuv_scaler_binary in load_video_binaries()
is followed with a dereference of mycs->yuv_scaler_binary after the
following call chain:

sh_css_pipe_load_binaries()
  |-> load_video_binaries(mycs->yuv_scaler_binary == NULL)
  |
  |-> sh_css_pipe_unload_binaries()
        |-> unload_video_binaries()

In unload_video_binaries(), it calls to ia_css_binary_unload with argument
&pipe->pipe_settings.video.yuv_scaler_binary[i], which refers to the
same memory slot as mycs->yuv_scaler_binary. Thus, a null-pointer
dereference is triggered.

Link: https://lore.kernel.org/r/20240118151303.3828292-1-alexious@zju.edu.cn
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: atomisp: Fix double negation in unsupported revision error
Hans de Goede [Mon, 19 Feb 2024 13:19:56 +0000 (14:19 +0100)]
media: atomisp: Fix double negation in unsupported revision error

s/is not unsupported/is not supported/ in the unsupported revision
error.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
5 months agomedia: v4l2-subdev: Fix stream handling for crop API
Laurent Pinchart [Mon, 1 Apr 2024 23:37:25 +0000 (02:37 +0300)]
media: v4l2-subdev: Fix stream handling for crop API

When support for streams was added to the V4L2 subdev API, the
v4l2_subdev_crop structure was extended with a stream field, but the
field was not handled in the core code that translates the
VIDIOC_SUBDEV_[GS]_CROP ioctls to the selection API. Fix it.

Fixes: 2f91e10ee6fd ("media: subdev: add stream based configuration")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: mc: Fix graph walk in media_pipeline_start
Tomi Valkeinen [Mon, 18 Mar 2024 09:50:59 +0000 (11:50 +0200)]
media: mc: Fix graph walk in media_pipeline_start

The graph walk tries to follow all links, even if they are not between
pads. This causes a crash with, e.g. a MEDIA_LNK_FL_ANCILLARY_LINK link.

Fix this by allowing the walk to proceed only for MEDIA_LNK_FL_DATA_LINK
links.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # for 6.1 and later
Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agostaging: media: ipu3-imgu: Update e-mail addresses
Sakari Ailus [Thu, 4 Apr 2024 08:41:15 +0000 (11:41 +0300)]
staging: media: ipu3-imgu: Update e-mail addresses

Remove e-mail addresses no longer in use.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dw9714: Update e-mail addresses
Sakari Ailus [Thu, 4 Apr 2024 08:37:39 +0000 (11:37 +0300)]
media: dw9714: Update e-mail addresses

Remove inactive e-mail addresses.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ipu3-cio2: Update e-mail addresses
Sakari Ailus [Thu, 4 Apr 2024 08:32:59 +0000 (11:32 +0300)]
media: ipu3-cio2: Update e-mail addresses

Remove e-mail addresses that are no longer valid.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: i2c: et8ek8: Don't strip remove function when driver is builtin
Uwe Kleine-König [Sun, 24 Mar 2024 16:00:44 +0000 (17:00 +0100)]
media: i2c: et8ek8: Don't strip remove function when driver is builtin

Using __exit for the remove function results in the remove callback
being discarded with CONFIG_VIDEO_ET8EK8=y. When such a device gets
unbound (e.g. using sysfs or hotplug), the driver is just removed
without the cleanup being performed. This results in resource leaks. Fix
it by compiling in the remove callback unconditionally.

This also fixes a W=1 modpost warning:

WARNING: modpost: drivers/media/i2c/et8ek8/et8ek8: section mismatch in reference: et8ek8_i2c_driver+0x10 (section: .data) -> et8ek8_remove (section: .exit.text)

Fixes: c5254e72b8ed ("[media] media: Driver for Toshiba et8ek8 5MP sensor")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ipu-cio2: Remove unnecessary runtime PM power state setting
Bjorn Helgaas [Mon, 25 Mar 2024 22:03:25 +0000 (17:03 -0500)]
media: ipu-cio2: Remove unnecessary runtime PM power state setting

ipu-cio2 uses generic power management, and pci_pm_runtime_suspend() and
pci_pm_runtime_resume() already take care of setting the PCI device power
state, so the driver doesn't need to do it explicitly.

Remove explicit setting to D3hot or D0 during runtime suspend and resume.

Remove #defines that are no longer used.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Hyungwoo Yang <hyungwoo.yang@intel.com>
Cc: Rajmohan Mani <rajmohan.mani@intel.com>
Cc: Vijaykumar Ramya <ramya.vijaykumar@intel.com>
Cc: Samu Onkalo <samu.onkalo@intel.com>
Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Jouni Ukkonen <jouni.ukkonen@intel.com>
Cc: Antti Laakso <antti.laakso@intel.com>
[Sakari Ailus: Remove now-redundant local variables.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agostaging: media: imx: Remove duplicate Kconfig dependency
Rajeshwar R Shinde [Fri, 29 Mar 2024 05:44:46 +0000 (11:14 +0530)]
staging: media: imx: Remove duplicate Kconfig dependency

The kernel configuration VIDEO_DEV is defined twice in Kconfig.
Thus, the duplicate Kconfig dependency is removed.

Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agostaging: media: ipu3: remove redundant assignment to pointer css_pipe
Colin Ian King [Thu, 28 Mar 2024 11:44:55 +0000 (11:44 +0000)]
staging: media: ipu3: remove redundant assignment to pointer css_pipe

Pointer css_pipe is being assigned a value that is never read afterwards.
The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/staging/media/ipu3/ipu3-css.c:2058:3: warning: Value stored
to 'css_pipe' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dt-bindings: ovti,ov2680: Document link-frequencies
Fabio Estevam [Tue, 2 Apr 2024 17:40:28 +0000 (14:40 -0300)]
media: dt-bindings: ovti,ov2680: Document link-frequencies

Document the link-frequencies property as recommended by the following
document:

https://www.kernel.org/doc/html/v6.9-rc1/driver-api/media/camera-sensor.html#handling-clocks

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dt-bindings: ovti,ov2680: Fix the power supply names
Fabio Estevam [Tue, 2 Apr 2024 17:40:27 +0000 (14:40 -0300)]
media: dt-bindings: ovti,ov2680: Fix the power supply names

The original .txt bindings had the OV2680 power supply names correct,
but the transition from .txt to yaml spelled them incorrectly.

Fix the OV2680 power supply names as the original .txt bindings
as these are the names used by the OV2680 driver and in devicetree.

Fixes: 57226cd8c8bf ("media: dt-bindings: ov2680: convert bindings to yaml")
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ov2680: Allow probing if link-frequencies is absent
Fabio Estevam [Thu, 28 Mar 2024 22:44:13 +0000 (19:44 -0300)]
media: ov2680: Allow probing if link-frequencies is absent

Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
property verification") the ov2680 no longer probes on a imx7s-warp7:

ov2680 1-0036: error -EINVAL: supported link freq 330000000 not found
ov2680 1-0036: probe with driver ov2680 failed with error -22

As the 'link-frequencies' property is not mandatory, allow the probe
to succeed by skipping the link-frequency verification when the
property is absent.

Cc: stable@vger.kernel.org
Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ov2680: Clear the 'ret' variable on success
Fabio Estevam [Thu, 28 Mar 2024 22:44:12 +0000 (19:44 -0300)]
media: ov2680: Clear the 'ret' variable on success

Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
property verification") even when the correct 'link-frequencies'
property is passed in the devicetree, the driver fails to probe:

ov2680 1-0036: probe with driver ov2680 failed with error -22

The reason is that the variable 'ret' may contain the -EINVAL value
from a previous assignment:

ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
       &rate);

Fix the problem by clearing 'ret' on the successful path.

Tested on imx7s-warp board with the following devicetree:

port {
ov2680_to_mipi: endpoint {
remote-endpoint = <&mipi_from_sensor>;
clock-lanes = <0>;
data-lanes = <1>;
link-frequencies = /bits/ 64 <330000000>;
};
};

Cc: stable@vger.kernel.org
Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ov2740: Fix LINK_FREQ and PIXEL_RATE control value reporting
Sakari Ailus [Wed, 27 Mar 2024 08:57:31 +0000 (10:57 +0200)]
media: ov2740: Fix LINK_FREQ and PIXEL_RATE control value reporting

The driver dug the supported link frequency up from the V4L2 fwnode
endpoint and used it internally, but failed to report this in the
LINK_FREQ and PIXEL_RATE controls. Fix this.

Fixes: 0677a2d9b735 ("media: ov2740: Add support for 180 MHz link frequency")
Cc: stable@vger.kernel.org # for v6.8 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l: async: Properly re-initialise notifier entry in unregister
Sakari Ailus [Fri, 8 Mar 2024 13:06:13 +0000 (15:06 +0200)]
media: v4l: async: Properly re-initialise notifier entry in unregister

The notifier_entry of a notifier is not re-initialised after unregistering
the notifier. This leads to dangling pointers being left there so use
list_del_init() to return the notifier_entry an empty list.

Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l: async: Don't set notifier's V4L2 device if registering fails
Sakari Ailus [Fri, 8 Mar 2024 13:07:45 +0000 (15:07 +0200)]
media: v4l: async: Don't set notifier's V4L2 device if registering fails

The V4L2 device used to be set when the notifier was registered but this
has been moved to the notifier initialisation. Don't touch the V4L2 device
if registration fails.

Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l: async: Fix notifier list entry init
Alexander Stein [Thu, 7 Mar 2024 14:24:51 +0000 (15:24 +0100)]
media: v4l: async: Fix notifier list entry init

struct v4l2_async_notifier has several list_head members, but only
waiting_list and done_list are initialized. notifier_entry was kept
'zeroed' leading to an uninitialized list_head.
This results in a NULL-pointer dereference if csi2_async_register() fails,
e.g. node for remote endpoint is disabled, and returns -ENOTCONN.
The following calls to v4l2_async_nf_unregister() results in a NULL
pointer dereference.
Add the missing list head initializer.

Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init")
Cc: <stable@vger.kernel.org> # for 6.6 and later
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: mc: Add nop implementations of media_device_{init,cleanup}
Sakari Ailus [Wed, 22 Nov 2017 15:30:45 +0000 (17:30 +0200)]
media: mc: Add nop implementations of media_device_{init,cleanup}

To support compilation with Media controller disabled, drivers were
required to conditionally call media_device_init and media_device_cleanup.
Add nop implementations of both so drivers don't need to care (or at least
care less).

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ipu3-cio2: Request IRQ earlier
Sakari Ailus [Tue, 20 Dec 2022 14:01:20 +0000 (16:01 +0200)]
media: ipu3-cio2: Request IRQ earlier

Call devm_request_irq() before registering the async notifier, as otherwise
it would be possible to use the device before the interrupts could be
delivered to the driver.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l2-subdev: Remove non-pad dv timing callbacks
Paweł Anikiel [Fri, 5 Apr 2024 14:14:11 +0000 (14:14 +0000)]
media: v4l2-subdev: Remove non-pad dv timing callbacks

After the conversion of dv timing calls to use a pad argument is done,
remove the old callbacks. Update the subdev ioctl handlers to use the
new callbacks.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: tegra-video: Use pad variant of dv timing subdev calls
Paweł Anikiel [Fri, 5 Apr 2024 14:14:10 +0000 (14:14 +0000)]
media: tegra-video: Use pad variant of dv timing subdev calls

Use the pad variant for all (s|g|query)_dv_timings subdev calls, which
includes a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: vpif_display: Use pad variant of dv timing subdev calls
Paweł Anikiel [Mon, 8 Apr 2024 15:10:02 +0000 (15:10 +0000)]
media: vpif_display: Use pad variant of dv timing subdev calls

Use the pad variant for all (s|g|query)_dv_timings subdev calls, which
includes a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: vpif_capture: Use pad variant of dv timing subdev calls
Paweł Anikiel [Fri, 5 Apr 2024 14:14:09 +0000 (14:14 +0000)]
media: vpif_capture: Use pad variant of dv timing subdev calls

Use the pad variant for all (s|g|query)_dv_timings subdev calls, which
includes a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: rcar-vin: Use pad variant of dv timing subdev calls
Paweł Anikiel [Fri, 5 Apr 2024 14:14:08 +0000 (14:14 +0000)]
media: rcar-vin: Use pad variant of dv timing subdev calls

Use the pad variant for all (s|g|query)_dv_timings subdev calls, which
includes a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: cobalt: Use pad variant of dv timing subdev calls
Paweł Anikiel [Fri, 5 Apr 2024 14:14:07 +0000 (14:14 +0000)]
media: cobalt: Use pad variant of dv timing subdev calls

Use the pad variant for all (s|g|query)_dv_timings subdev calls, which
includes a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: spi: gs1662: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:06 +0000 (14:14 +0000)]
media: spi: gs1662: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: tvp7002: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:05 +0000 (14:14 +0000)]
media: i2c: tvp7002: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: ths8200: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:04 +0000 (14:14 +0000)]
media: i2c: ths8200: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: i2c: ths7303: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:03 +0000 (14:14 +0000)]
media: i2c: ths7303: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: tda1997x: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:02 +0000 (14:14 +0000)]
media: i2c: tda1997x: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: tc358743: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:01 +0000 (14:14 +0000)]
media: i2c: tc358743: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: adv7842: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:14:00 +0000 (14:14 +0000)]
media: i2c: adv7842: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: i2c: adv7604: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:13:59 +0000 (14:13 +0000)]
media: i2c: adv7604: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: adv7511: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:13:58 +0000 (14:13 +0000)]
media: i2c: adv7511: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: align to open parenthesis]

5 months agomedia: i2c: adv748x: Switch dv timing callbacks to pad ops
Paweł Anikiel [Fri, 5 Apr 2024 14:13:57 +0000 (14:13 +0000)]
media: i2c: adv748x: Switch dv timing callbacks to pad ops

Change all (s|g|query)_dv_timings subdev callbacks to include
a pad argument.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l2-subdev: Add pad versions of dv timing subdev calls
Paweł Anikiel [Fri, 5 Apr 2024 14:13:56 +0000 (14:13 +0000)]
media: v4l2-subdev: Add pad versions of dv timing subdev calls

Currently, subdev dv timing calls (i.e. g/s/query_dv_timings) are video
ops without a pad argument. This is a problem if the subdevice can have
different dv timings for each pad (e.g. a DisplayPort receiver with
multiple virtual channels).

To solve this, change these calls to include a pad argument, and put
them into pad ops. Keep the old ones temporarily to make the switch
easier.

Signed-off-by: Paweł Anikiel <panikiel@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: qcom: camss: vfe-17x: Rename camss-vfe-170 to camss-vfe-17x
Bryan O'Donoghue [Thu, 22 Feb 2024 17:17:04 +0000 (17:17 +0000)]
media: qcom: camss: vfe-17x: Rename camss-vfe-170 to camss-vfe-17x

vfe-170 and vfe-175 can be supported in the same file with some minimal
indirection to differentiate between the silicon versions.

sdm845 uses vfe-170, sc8280xp uses vfe-175-200. Lets rename the file to
capture its wider scope than vfe-170 only.

Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: qcom: camss: Add sc8280xp support
Bryan O'Donoghue [Thu, 22 Feb 2024 17:17:03 +0000 (17:17 +0000)]
media: qcom: camss: Add sc8280xp support

Add in functional logic throughout the code to support the sc8280xp.

Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: qcom: camss: Add sc8280xp resources
Bryan O'Donoghue [Thu, 22 Feb 2024 17:17:02 +0000 (17:17 +0000)]
media: qcom: camss: Add sc8280xp resources

This commit describes the hardware layout for the sc8280xp for the
following hardware blocks:

- 4 x VFE, 4 RDI per VFE
- 4 x VFE Lite, 4 RDI per VFE
- 4 x CSID
- 4 x CSID Lite
- 4 x CSI PHY

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: qcom: camss: Add CAMSS_SC8280XP enum
Bryan O'Donoghue [Thu, 22 Feb 2024 17:17:01 +0000 (17:17 +0000)]
media: qcom: camss: Add CAMSS_SC8280XP enum

Adds a CAMSS SoC identifier for the SC8280XP.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: qcom: camss: csiphy-3ph: Add Gen2 v1.1 two-phase MIPI CSI-2 DPHY init
Bryan O'Donoghue [Thu, 22 Feb 2024 17:17:00 +0000 (17:17 +0000)]
media: qcom: camss: csiphy-3ph: Add Gen2 v1.1 two-phase MIPI CSI-2 DPHY init

Add a PHY configuration sequence for the sc8280xp which uses a Qualcomm
Gen 2 version 1.1 CSI-2 PHY.

The PHY can be configured as two phase or three phase in C-PHY or D-PHY
mode. This configuration supports two-phase D-PHY mode.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: dt-bindings: media: camss: Add qcom,sc8280xp-camss binding
Bryan O'Donoghue [Thu, 22 Feb 2024 17:16:59 +0000 (17:16 +0000)]
media: dt-bindings: media: camss: Add qcom,sc8280xp-camss binding

Add bindings for qcom,sc8280xp-camss in order to support the camera
subsystem for sc8280xp as found in the Lenovo x13s Laptop.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: platform: cros-ec: provide ID table for avoiding fallback match
Tzung-Bi Shih [Mon, 1 Apr 2024 03:00:47 +0000 (11:00 +0800)]
media: platform: cros-ec: provide ID table for avoiding fallback match

Instead of using fallback driver name match, provide ID table[1] for the
primary match.

[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353

Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: mmc: siano: simplify module initialization
Krzysztof Kozlowski [Fri, 29 Mar 2024 17:11:19 +0000 (18:11 +0100)]
media: mmc: siano: simplify module initialization

This driver's initialization functions do not perform any custom code,
except printing messages.  Printing messages on modules
loading/unloading is discouraged because it pollutes the dmesg
regardless whether user actually has this device.  Core kernel code
already gives tools to investigate whether module was loaded or not.

Drop the printing messages which allows to replace open-coded
module_sdio_driver().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: docs: Remove the repeated word "the" in docs.
hanchunchao [Fri, 29 Mar 2024 03:31:37 +0000 (11:31 +0800)]
media: docs: Remove the repeated word "the" in docs.

Fix "The the" typo in the documentation.

Signed-off-by: hanchunchao <hanchunchao@inspur.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: added commit log]

5 months agomedia: dvbdev: Initialize sbuf
Ricardo Ribalda [Mon, 25 Mar 2024 14:50:25 +0000 (14:50 +0000)]
media: dvbdev: Initialize sbuf

Because the size passed to copy_from_user() cannot be known beforehand,
it needs to be checked during runtime with check_object_size. That makes
gcc believe that the content of sbuf can be used before init.

Fix:
./include/linux/thread_info.h:215:17: warning: ‘sbuf’ may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: radio-shark2: Avoid led_names truncations
Ricardo Ribalda [Mon, 25 Mar 2024 14:50:24 +0000 (14:50 +0000)]
media: radio-shark2: Avoid led_names truncations

Increase the size of led_names so it can fit any valid v4l2 device name.

Fixes:
drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agostaging: media: tegra-video: Fix -Wmaybe-unitialized warn in gcc
Ricardo Ribalda [Mon, 25 Mar 2024 14:50:23 +0000 (14:50 +0000)]
staging: media: tegra-video: Fix -Wmaybe-unitialized warn in gcc

Make sure that tegra20_vi_get_input_formats always assign a value for
yuv_input_format.

Fix:
drivers/staging/media/tegra-video/tegra20.c:624:72: warning: ‘yuv_input_format’ may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: rcar-vin: work around -Wenum-compare-conditional warning
Arnd Bergmann [Fri, 22 Mar 2024 13:33:46 +0000 (14:33 +0100)]
media: rcar-vin: work around -Wenum-compare-conditional warning

clang-19 warns about mixing two enum types here:

drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-core.c:216:18: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]

This one is intentional, and there is already a cast to work around another
warning, so address this by adding another cast.

Fixes: 406bb586dec0 ("media: rcar-vin: Add r8a779a0 support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: admin-guide: Fix mgb4 driver documentation structure
Martin Tůma [Mon, 18 Mar 2024 16:09:19 +0000 (17:09 +0100)]
media: admin-guide: Fix mgb4 driver documentation structure

Fix the mgb4 driver documentation structure that breaks the
"Video4Linux (V4L) driver-specific documentation" outline.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: docs: Fix mem_offset name in multiplane example
Matthijs Kooijman [Thu, 14 Mar 2024 16:06:07 +0000 (17:06 +0100)]
media: docs: Fix mem_offset name in multiplane example

The v4l2_buffer type has an "offset" field, but the corresponding field
in the v4l2_plane type is called "mem_offset". Use the correct name in
this example.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l2-common: Add Y210 and Y216 format info
Jacopo Mondi [Wed, 13 Mar 2024 15:41:27 +0000 (16:41 +0100)]
media: v4l2-common: Add Y210 and Y216 format info

According to the formats description in videodev2.h Y210, Y212 and Y216
are YCbCr packed formats. For each Y2xx format, xx bits of valid data
occupy the MSBs of the 16 bit components, and 16-xx bits of zero padding
occupy the LSBs.

The Y210 and Y216 formats are missing an entry in the v4l2_format_info[]
table. Add it.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agostaging: media: starfive: Remove links when unregistering devices
Changhuang Liang [Mon, 11 Mar 2024 12:03:09 +0000 (05:03 -0700)]
staging: media: starfive: Remove links when unregistering devices

Need to remove links when unregistering devices.

Fixes: ac7da4a73b10 ("media: staging: media: starfive: camss: Register devices")

Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: cxd2880: Add terminating new line to Kconfig
Prasad Pandit [Mon, 11 Mar 2024 10:04:07 +0000 (15:34 +0530)]
media: cxd2880: Add terminating new line to Kconfig

Add terminating new line to the Kconfig file.

Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: dropped 'Fixes' tag, not relevant for this]

5 months agomedia: staging: media: starfive: camss: Convert to platform remove callback returning...
Uwe Kleine-König [Fri, 8 Mar 2024 08:51:16 +0000 (09:51 +0100)]
media: staging: media: starfive: camss: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: v4l2-ctrls: add support for area type logging
Hans Verkuil [Wed, 6 Mar 2024 13:49:21 +0000 (14:49 +0100)]
media: v4l2-ctrls: add support for area type logging

A 'case V4L2_CTRL_TYPE_AREA' was missing in v4l2_ctrl_type_op_log,
which led to an 'unknown type' message in the kernel log.

Add support for controls of this type.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: ngene: Add dvb_ca_en50221_init return value check
Aleksandr Burakov [Fri, 1 Mar 2024 11:15:53 +0000 (14:15 +0300)]
media: ngene: Add dvb_ca_en50221_init return value check

The return value of dvb_ca_en50221_init() is not checked here that may
cause undefined behavior in case of nonzero value return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 25aee3debe04 ("[media] Rename media/dvb as media/pci")
Signed-off-by: Aleksandr Burakov <a.burakov@rosalinux.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
5 months agomedia: anysee: accept read buffers of length 1 in anysee_master_xfer
István Váradi [Tue, 13 Feb 2024 20:20:32 +0000 (21:20 +0100)]
media: anysee: accept read buffers of length 1 in anysee_master_xfer

anysee_master_xfer currently accepts read messages of length 2 only.
However, several frontends, e.g. tda10023 send buffers of length 1,
containing an 8-bit register number (see tda10023_readreg).
These buffers are rejected currently, making many Anysee variants
to not work. In these cases the "Unsupported Anysee version"
message is logged.

This patch alters the function to accept buffers of a length of 1 too.

Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: add spaces around '<', fix typo in 'sevaral']

5 months agoMerge tag 'v6.9-rc2' into media_stage
Hans Verkuil [Mon, 1 Apr 2024 08:08:18 +0000 (10:08 +0200)]
Merge tag 'v6.9-rc2' into media_stage

Linux 6.9-rc2

This is needed to pull in commit 11763a8598f88 ("fs/9p: fix uaf in
in v9fs_stat2inode_dotl"), which fixes the broken virtme. With this
fix the media regression tests can be run again without crashing.

5 months agoLinux 6.9-rc2 v6.9-rc2
Linus Torvalds [Sun, 31 Mar 2024 21:32:39 +0000 (14:32 -0700)]
Linux 6.9-rc2

5 months agoMerge tag 'kbuild-fixes-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahi...
Linus Torvalds [Sun, 31 Mar 2024 18:23:51 +0000 (11:23 -0700)]
Merge tag 'kbuild-fixes-v6.9' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Deduplicate Kconfig entries for CONFIG_CXL_PMU

 - Fix unselectable choice entry in MIPS Kconfig, and forbid this
   structure

 - Remove unused include/asm-generic/export.h

 - Fix a NULL pointer dereference bug in modpost

 - Enable -Woverride-init warning consistently with W=1

 - Drop KCSAN flags from *.mod.c files

* tag 'kbuild-fixes-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: Fix typo HEIGTH to HEIGHT
  Documentation/llvm: Note s390 LLVM=1 support with LLVM 18.1.0 and newer
  kbuild: Disable KCSAN for autogenerated *.mod.c intermediaries
  kbuild: make -Woverride-init warnings more consistent
  modpost: do not make find_tosym() return NULL
  export.h: remove include/asm-generic/export.h
  kconfig: do not reparent the menu inside a choice block
  MIPS: move unselectable FIT_IMAGE_FDT_EPM5 out of the "System type" choice
  cxl: remove CONFIG_CXL_PMU entry in drivers/cxl/Kconfig