]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
13 months agomedia: av7110: coding style fixes: assignments
Stefan Herdler [Tue, 7 May 2024 00:24:53 +0000 (02:24 +0200)]
media: av7110: coding style fixes: assignments

This patch fixes the following checkpatch errors:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: coding style fixes: braces
Stefan Herdler [Tue, 7 May 2024 00:24:52 +0000 (02:24 +0200)]
media: av7110: 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
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>
13 months agomedia: av7110: coding style fixes: comments
Stefan Herdler [Tue, 7 May 2024 00:24:51 +0000 (02:24 +0200)]
media: av7110: coding style fixes: comments

This patch fixes the following checkpatch warnings:

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines
WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
WARNING:EMBEDDED_FILENAME: 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>
13 months agomedia: av7110: coding style fixes: whitespace (strict)
Stefan Herdler [Tue, 7 May 2024 00:24:50 +0000 (02:24 +0200)]
media: av7110: coding style fixes: whitespace (strict)

This patch fixes the following checkpatch warnings:

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
CHECK:SPACING: No space is necessary after a cast
CHECK:SPACING: space preferred before that '|' (ctx:VxE)
CHECK:SPACING: spaces preferred around that '&' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '*' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '>>' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '|' (ctx:VxV)

Additional whitespace fixes found by "checkpatch.pl --strict".

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: coding style fixes: newline
Stefan Herdler [Tue, 7 May 2024 00:24:49 +0000 (02:24 +0200)]
media: av7110: coding style fixes: newline

This patch fixes the following checkpatch warnings:

ERROR:ELSE_AFTER_BRACE: else should follow close brace '}'
ERROR:OPEN_BRACE: open brace '{' following enum go on the same line
ERROR:OPEN_BRACE: open brace '{' following struct go on the same line
ERROR:OPEN_BRACE: that open brace { should be on the previous line
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the previous line

Newline and whitespace changes only.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: coding style fixes: whitespace
Stefan Herdler [Tue, 7 May 2024 00:24:48 +0000 (02:24 +0200)]
media: av7110: coding style fixes: whitespace

This patch fixes the following checkpatch warnings:

ERROR:SPACING: need consistent spacing around '&' (ctx:WxO)
ERROR:SPACING: need consistent spacing around '&' (ctx:WxV)
ERROR:SPACING: need consistent spacing around '-' (ctx:WxV)
ERROR:SPACING: space prohibited after that '~' (ctx:OxW)
ERROR:SPACING: space prohibited after that open parenthesis '('
ERROR:SPACING: space prohibited before that close parenthesis ')'
ERROR:SPACING: space prohibited before that ':' (ctx:WxE)
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 that '~' (ctx:OxV)
ERROR:SPACING: space required before the open brace '{'
ERROR:SPACING: space required before the open parenthesis '('
ERROR:SPACING: spaces required around that '&&' (ctx:ExV)
ERROR:SPACING: spaces required around that '!=' (ctx:VxO)
ERROR:SPACING: spaces required around that '&=' (ctx:VxO)
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)
ERROR:SPACING: spaces required around that '<' (ctx:VxV)
ERROR:SPACING: spaces required around that '<=' (ctx:VxV)
ERROR:SPACING: spaces required around that '=' (ctx:VxV)
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:LEADING_SPACE: please, no spaces at the start of a line
WARNING:QUOTED_WHITESPACE_BEFORE_NEWLINE: unnecessary whitespace before a quoted newline
WARNING:SPACING: space prohibited before semicolon
WARNING:SPACING: space prohibited between function name and open parenthesis '('
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 23)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 32)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (32, 39)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (39, 47)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (47, 55)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 18)
WARNING:TABSTOP: Statements should start on a tabstop
CHECK:SPACING: No space is necessary after a cast
CHECK:SPACING: space preferred before that '|' (ctx:VxE)
CHECK:SPACING: spaces preferred around that '&' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '*' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '>>' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '|' (ctx:VxV)

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: coding style fixes: blank lines
Stefan Herdler [Tue, 7 May 2024 00:24:47 +0000 (02:24 +0200)]
media: av7110: coding style fixes: blank lines

This patch fixes the following checkpatch warnings:

CHECK:LINE_SPACING: Please don't use multiple blank lines
CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
CHECK:BRACES: Blank lines aren't necessary before a close brace '}'
WARNING:LINE_SPACING: Missing a blank line after declarations

Added or removed blank lines only.
"git diff --ignore-blank-lines" shows no changes.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: coding style fixes: pointer_location
Stefan Herdler [Tue, 7 May 2024 00:24:46 +0000 (02:24 +0200)]
media: av7110: coding style fixes: pointer_location

This patch fixes the following checkpatch warnings:

ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: sp8870: coding style fixes: logging
Stefan Herdler [Tue, 7 May 2024 00:24:45 +0000 (02:24 +0200)]
media: sp8870: coding style fixes: logging

This patch fixes the following checkpatch warnings:

WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level
WARNING:TRACING_LOGGING: Unnecessary ftrace-like logging - prefer using ftrace
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line

Convert logging to the recommend pr_* macros.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: sp8870: coding style fixes: miscellaneous
Stefan Herdler [Tue, 7 May 2024 00:24:44 +0000 (02:24 +0200)]
media: sp8870: coding style fixes: miscellaneous

This patch fixes the following checkpatch:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
WARNING:BRACES: braces {} are not necessary for any arm of this statement
WARNING:CONST_STRUCT: struct dvb_frontend_ops should normally be const
WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable
CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*state)...) over kzalloc(sizeof(struct sp8870_state)...)
CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written ...
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: sp8870: coding style fixes: newline, comments and braces
Stefan Herdler [Tue, 7 May 2024 00:24:43 +0000 (02:24 +0200)]
media: sp8870: coding style fixes: newline, comments and braces

This patch fixes the following checkpatch warnings:

ERROR:OPEN_BRACE: open brace '{' following struct go on the same line
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line [*]
WARNING:LINE_SPACING: Missing a blank line after declarations
WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
CHECK:LINE_SPACING: Please don't use multiple blank lines
CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations

Except the 2 comment-blocks, newline changes only.
[* The remaining trailing statement will be fixed in the logging patch.]

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: sp8870: coding style fixes: whitespace
Stefan Herdler [Tue, 7 May 2024 00:24:42 +0000 (02:24 +0200)]
media: sp8870: coding style fixes: whitespace

This patch fixes the following checkpatch warnings:

ERROR:BRACKET_SPACE: space prohibited before open square bracket '['
ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar"
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
ERROR:SPACING: space required before the open brace '{'
WARNING:SPACING: space prohibited between function name and open parenthesis '('
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: remove budget-patch driver
Stefan Herdler [Tue, 7 May 2024 00:24:41 +0000 (02:24 +0200)]
media: av7110: remove budget-patch driver

This patch removes the budget-patch stand alone driver only.
This patch does *not* remove the budget-patch support from the av7110
     (= dvb-ttpci) driver.
This patch does also *not* remove the support for the full-ts mod.

The budget-patch is an obsolete, experimental hardware modification, which
aimed to receive the whole transport stream of a transponder by bypassing
the av7110. This modification never worked reliably enough to be used in a
productive environment.
"almost no packet loss" [budget-patch.c #522] is still a packet loss.

The successor of the budget-patch is the full-ts mod, which is reliable.
The full-ts mod circuit is found on the never rev. 2.2 and 2.3 DVB-S
cards ex factory. The full-ts mod support is (only) in the av7110
(= dvb-ttpci) driver.

The budget-patch driver is a stand alone driver, which turns the card into
a budget card. It doesn't appear to be ever intended for the average user.
"Card is required to have loaded firmware to tune properly. Firmware can
be loaded by insertion and removal of standard av7110 driver prior to
loading this driver." [Kconfig]

There is support for the budget-patch in the av7110 (= dvb-ttpci) driver
too, which isn't affected by this patch.

The budget-patch is obsolete and replaced by the full-ts mod quiet a while
now. Remove the budget-patch driver left over from development.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: av7110: remove old documentation files
Stefan Herdler [Tue, 7 May 2024 00:24:40 +0000 (02:24 +0200)]
media: av7110: remove old documentation files

The documentation has been update and is now at:
linux/Documentation/userspace-api/media/dvb/legacy_dvb_osd.rst
linux/Documentation/userspace-api/media/dvb/legacy_dvb_audio.rst
linux/Documentation/userspace-api/media/dvb/legacy_dvb_video.rst

The .rst files of the old documentation aren't necessary any more,
remove them.

Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: ov5693: Drop privacy-LED GPIO control
Hans de Goede [Sat, 1 Jun 2024 17:39:37 +0000 (19:39 +0200)]
media: ov5693: Drop privacy-LED GPIO control

Drop privacy-LED GPIO control, after the privacy-LED GPIO control was added
to the ov5693 driver it was decided to model privacy-LEDs as LED class
devices and have them be controlled by the v4l2-core.

So this is dead code since on devices with privacy LEDs the led is not
a GPIO on the ov5693 fwnode, but rather is a LED class devices controlled
by the v4l2-core.

Signed-off-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>
13 months agodrivers: media: max96717: stop the csi receiver before the source
Julien Massot [Tue, 30 Apr 2024 13:19:31 +0000 (15:19 +0200)]
drivers: media: max96717: stop the csi receiver before the source

Stopping the CSI source before stopping the serializer
CSI port may make the serializer not respond.
Then all the next writes to the device will fail.

max96717 1-0040: Error writing reg 0x0308: -121
max96717 1-0040: Error writing reg 0x0006: -121

Fix that by stopping the CSI receiver first and then CSI source.

Seen on max96717f revision 4.

Signed-off-by: Julien Massot <julien.massot@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: add MAX96714 driver
Julien Massot [Tue, 30 Apr 2024 13:19:30 +0000 (15:19 +0200)]
media: i2c: add MAX96714 driver

This driver handles the MAX96714 deserializer in tunnel mode.
The CSI output will replicate all the CSI traffic forwarded by
the remote serializer.

The MAX96714 driver can handle MAX96714 and MAX96714F variants
with the same "maxim,max96714f" compatible.

Signed-off-by: Julien Massot <julien.massot@collabora.com>
[Sakari Ailus: Adapt to changed i2c_mux_add_adapter arguments.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: add MAX96717 driver
Julien Massot [Tue, 30 Apr 2024 13:19:29 +0000 (15:19 +0200)]
media: i2c: add MAX96717 driver

This driver handles the MAX96717 serializer in tunnel mode.
All incoming CSI traffic will be tunneled through the GMSL2
link.

The MAX96717 driver can handle MAX96717 and MAX96717F variants
with the same "maxim,max96717f" compatible.

Signed-off-by: Julien Massot <julien.massot@collabora.com>
[Sakari Ailus: Adapt to changed i2c_mux_add_adapter arguments.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agodt-bindings: media: add Maxim MAX96714 GMSL2 Deserializer
Julien Massot [Tue, 30 Apr 2024 13:19:28 +0000 (15:19 +0200)]
dt-bindings: media: add Maxim MAX96714 GMSL2 Deserializer

Add DT bindings for Maxim MAX96714 GMSL2 Deserializer.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agodt-bindings: media: add Maxim MAX96717 GMSL2 Serializer
Julien Massot [Tue, 30 Apr 2024 13:19:27 +0000 (15:19 +0200)]
dt-bindings: media: add Maxim MAX96717 GMSL2 Serializer

Add DT bindings for Maxim MAX96717 GMSL2 Serializer.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: rkisp1: Mark subdev state pointers as const
Laurent Pinchart [Wed, 8 May 2024 21:40:45 +0000 (00:40 +0300)]
media: rkisp1: Mark subdev state pointers as const

Several subdev state pointers are used to access the state read-only.
Mark them as const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: v4l2-subdev: Provide const-aware subdev state accessors
Laurent Pinchart [Wed, 8 May 2024 21:40:43 +0000 (00:40 +0300)]
media: v4l2-subdev: Provide const-aware subdev state accessors

It would be useful to mark instances of v4l2_subdev_state structures as
const when code needs to access them read-only. This isn't currently
possible, as the v4l2_subdev_state_get_*() accessor functions take a
non-const pointer to the state.

Use _Generic() to provide two different versions of the accessors, for
const and non-const states respectively. The former returns a const
pointer to the requested format, rectangle or interval, implementing
const-correctness. The latter returns a non-const pointer, preserving
the current behaviour for drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
[Sakari Ailus: Drop the word "below" from the text.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: v4l2-subdev: Fix v4l2_subdev_state_get_format() documentation
Laurent Pinchart [Wed, 8 May 2024 21:40:43 +0000 (00:40 +0300)]
media: v4l2-subdev: Fix v4l2_subdev_state_get_format() documentation

The documentation of the v4l2_subdev_state_get_format() macro
incorrectly references __v4l2_subdev_state_get_format() instead of
__v4l2_subdev_state_gen_call(). Fix it, and also update the list of
similar macros to add the missing v4l2_subdev_state_get_interval().

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: v4l2-cci: Always assign *val
Sakari Ailus [Tue, 28 May 2024 11:00:51 +0000 (14:00 +0300)]
media: v4l2-cci: Always assign *val

Always assign *val to 0 in cci_read(). This has the benefit of not
requiring initialisation of the variables data is read to using
cci_read(). Once smatch is fixed, it could catch the use of uninitialised
reads.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: ipu6: Print CSR messages using debug level
Sakari Ailus [Thu, 23 May 2024 10:07:14 +0000 (13:07 +0300)]
media: ipu6: Print CSR messages using debug level

It's entirely normal CSR will return non-indicative values after its reset
(0). There's no need to warn the user about that.

Suggested-by: Bingbu Cao <bingbu.cao@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: adv7511: remove unused struct 'i2c_reg_value'
Dr. David Alan Gilbert [Fri, 24 May 2024 16:48:51 +0000 (17:48 +0100)]
media: i2c: adv7511: remove unused struct 'i2c_reg_value'

'i2c_reg_value' is unused since the original
commit 5a544cce2177 ("[media] adv7511: add new video encoder").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: tw9910: remove unused strust 'regval_list'
Dr. David Alan Gilbert [Fri, 24 May 2024 16:48:50 +0000 (17:48 +0100)]
media: i2c: tw9910: remove unused strust 'regval_list'

'regval_list' has been unused since
commit 398994c1e104 ("V4L/DVB (13666): tw9910: modify V/H outpit pin
setting to use VALID").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: ks0127: remove unused struct 'adjust'
Dr. David Alan Gilbert [Fri, 24 May 2024 16:48:49 +0000 (17:48 +0100)]
media: i2c: ks0127: remove unused struct 'adjust'

'adjust' has been unused since original
commit fbe60daac4c3 ("V4L/DVB (3916): AverMedia 6 Eyes AVS6EYES
support").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: dw9768: remove unused struct 'regval_list'
Dr. David Alan Gilbert [Fri, 24 May 2024 16:48:48 +0000 (17:48 +0100)]
media: i2c: dw9768: remove unused struct 'regval_list'

'regval_list' is unused since the original
commit 859891228e56 ("media: i2c: dw9768: Add DW9768 VCM driver")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: Add imx283 camera sensor driver
Kieran Bingham [Tue, 2 Apr 2024 10:07:51 +0000 (15:37 +0530)]
media: i2c: Add imx283 camera sensor driver

Add a v4l2 subdevice driver for the Sony IMX283 image sensor.

The IMX283 is a 20MP Diagonal 15.86 mm (Type 1) CMOS Image Sensor with
Square Pixel for Color Cameras.

The following features are supported:
- Manual exposure an gain control support
- vblank/hblank/link freq control support
- Test pattern support control
- Arbitrary horizontal and vertical cropping
- Supported resolution:
  - 5472x3648 @ 20fps (SRGGB12)
  - 5472x3648 @ 25fps (SRGGB10)
  - 2736x1824 @ 50fps (SRGGB12)

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
[Sakari Ailus: Take upstream runtime PM API changes into account.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dt-bindings: media: Add bindings for IMX283
Umang Jain [Tue, 2 Apr 2024 10:07:50 +0000 (15:37 +0530)]
media: dt-bindings: media: Add bindings for IMX283

- Add dt-bindings documentation for Sony IMX283 sensor driver
- Add MAINTAINERS entry for Sony IMX283 binding documentation

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: subdev: Improve s_stream documentation
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:14 +0000 (18:39 +0300)]
media: subdev: Improve s_stream documentation

Now that enable/disable_streams operations are available for
single-stream subdevices too, there's no reason to use the old s_stream
operation on new drivers. Extend the documentation reflecting this.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Umang Jain<umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: subdev: Support non-routing subdevs in v4l2_subdev_s_stream_helper()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:13 +0000 (18:39 +0300)]
media: subdev: Support non-routing subdevs in v4l2_subdev_s_stream_helper()

At the moment v4l2_subdev_s_stream_helper() only works for subdevices
that support routing. As enable/disable_streams now also works for
subdevices without routing, improve v4l2_subdev_s_stream_helper() to do
the same.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Support single-stream case in v4l2_subdev_enable/disable_streams()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:12 +0000 (18:39 +0300)]
media: subdev: Support single-stream case in v4l2_subdev_enable/disable_streams()

At the moment the v4l2_subdev_enable/disable_streams() functions call
fallback helpers to handle the case where the subdev only implements
.s_stream(), and the main function handles the case where the subdev
implements streams (V4L2_SUBDEV_FL_STREAMS, which implies
.enable/disable_streams()).

What is missing is support for subdevs which do not implement streams
support, but do implement .enable/disable_streams(). Example cases of
these subdevices are single-stream cameras, where using
.enable/disable_streams() is not required but helps us remove the users
of the legacy .s_stream(), and subdevices with multiple source pads (but
single stream per pad), where .enable/disable_streams() allows the
subdevice to control the enable/disable state per pad.

The two single-streams cases (.s_stream() and .enable/disable_streams())
are very similar, and with small changes we can change the
v4l2_subdev_enable/disable_streams() functions to support all three
cases, without needing separate fallback functions.

A few potentially problematic details, though:

- For the single-streams cases we use sd->enabled_pads field, which
  limits the number of pads for the subdevice to 64. For simplicity I
  added the check for this limitation to the beginning of the function,
  and it also applies to the streams case.

- The fallback functions only allowed the target pad to be a source pad.
  It is not very clear to me why this check was needed, but it was not
  needed in the streams case. However, I doubt the
  v4l2_subdev_enable/disable_streams() code has ever been tested with
  sink pads, so to be on the safe side, I added the same check
  to the v4l2_subdev_enable/disable_streams() functions.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Refactor v4l2_subdev_enable/disable_streams()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:11 +0000 (18:39 +0300)]
media: subdev: Refactor v4l2_subdev_enable/disable_streams()

Add two internal helper functions, v4l2_subdev_collect_streams() and
v4l2_subdev_set_streams_enabled(), which allows us to refactor
v4l2_subdev_enable/disable_streams() functions.

This (I think) makes the code a bit easier to read, and lets us more
easily add new functionality in the helper functions in the following
patch.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Support privacy led in v4l2_subdev_enable/disable_streams()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:10 +0000 (18:39 +0300)]
media: subdev: Support privacy led in v4l2_subdev_enable/disable_streams()

We support camera privacy leds with the .s_stream() operation, in
call_s_stream(), but we don't have that support when the subdevice
implements .enable/disable_streams() operations.

Add the support by enabling the led when the first stream for a
subdevice is enabled, and disabling the led then the last stream is
disabled.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Add v4l2_subdev_is_streaming()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:09 +0000 (18:39 +0300)]
media: subdev: Add v4l2_subdev_is_streaming()

Add a helper function which returns whether the subdevice is streaming,
i.e. if .s_stream or .enable_streams has been called successfully.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Improve v4l2_subdev_enable/disable_streams_fallback
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:08 +0000 (18:39 +0300)]
media: subdev: Improve v4l2_subdev_enable/disable_streams_fallback

v4l2_subdev_enable/disable_streams_fallback() supports falling back to
.s_stream() for subdevs with a single source pad. It also tracks the
enabled streams for that one pad in the sd->enabled_streams field.

Tracking the enabled streams with sd->enabled_streams does not make
sense, as with .s_stream() there can only be a single stream per pad.
Thus, as the v4l2_subdev_enable/disable_streams_fallback() only supports
a single source pad, all we really need is a boolean which tells whether
streaming has been enabled on this pad or not.

However, as we only need a true/false state for a pad (instead of
tracking which streams have been enabled for a pad), we can easily
extend the fallback mechanism to support multiple source pads as we only
need to keep track of which pads have been enabled.

Change the sd->enabled_streams field to sd->enabled_pads, which is a
64-bit bitmask tracking the enabled source pads. With this change we can
remove the restriction that
v4l2_subdev_enable/disable_streams_fallback() only supports a single
source pad.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Fix use of sd->enabled_streams in call_s_stream()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:07 +0000 (18:39 +0300)]
media: subdev: Fix use of sd->enabled_streams in call_s_stream()

call_s_stream() uses sd->enabled_streams to track whether streaming has
already been enabled. However,
v4l2_subdev_enable/disable_streams_fallback(), which was the original
user of this field, already uses it, and
v4l2_subdev_enable/disable_streams_fallback() will call call_s_stream().

This leads to a conflict as both functions set the field. Afaics, both
functions set the field to the same value, so it won't cause a runtime
bug, but it's still wrong and if we, e.g., change how
v4l2_subdev_enable/disable_streams_fallback() operates we might easily
cause bugs.

Fix this by adding a new field, 's_stream_enabled', for
call_s_stream().

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Add checks for subdev features
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:06 +0000 (18:39 +0300)]
media: subdev: Add checks for subdev features

Add some checks to verify that the subdev driver implements required
features.

A subdevice that supports streams (V4L2_SUBDEV_FL_STREAMS) must do one
of the following:

- Implement neither .enable/disable_streams() nor .s_stream(), if the
  subdev is part of a video driver that uses an internal method to
  enable the subdev.
- Implement only .enable/disable_streams(), if support for legacy
  sink-side subdevices is not needed.
- Implement .enable/disable_streams() and .s_stream(), if support for
  legacy sink-side subdevices is needed.

At the moment the framework doesn't check this requirement. Add the
check.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Use v4l2_subdev_has_op() in v4l2_subdev_enable/disable_streams()
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:05 +0000 (18:39 +0300)]
media: subdev: Use v4l2_subdev_has_op() in v4l2_subdev_enable/disable_streams()

Use v4l2_subdev_has_op() in v4l2_subdev_enable/disable_streams() instead
of open coding the same.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: subdev: Add privacy led helpers
Tomi Valkeinen [Wed, 24 Apr 2024 15:39:04 +0000 (18:39 +0300)]
media: subdev: Add privacy led helpers

Add helper functions to enable and disable the privacy led. This moves
the #if from the call site to the privacy led functions, and makes
adding privacy led support to v4l2_subdev_enable/disable_streams()
cleaner.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-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>
13 months agomedia: ipu6: Rework CSI-2 sub-device streaming control
Sakari Ailus [Thu, 30 May 2024 10:38:07 +0000 (13:38 +0300)]
media: ipu6: Rework CSI-2 sub-device streaming control

CSI-2 sub-device streaming control should use {enable,disable}_streams pad
ops and not s_stream video ops as the sub-device supports streams. Fix
this by removing driver-implemented stream management and moving sensor
streaming control to the CSI-2 sub-device sub-driver.

Fixes: a11a5570a09d ("media: intel/ipu6: add IPU6 CSI2 receiver v4l2 sub-device")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: staging: max96712: Store format in subdev active state
Niklas Söderlund [Fri, 10 May 2024 15:56:06 +0000 (17:56 +0200)]
media: staging: max96712: Store format in subdev active state

Create and store the subdevice format in the subdevices active state.
This change do not have a huge effect on the driver as it do not yet
support changing the format.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: async: Warn on attept to create an ancillary link to a non-subdev
Sakari Ailus [Mon, 20 May 2024 07:28:20 +0000 (10:28 +0300)]
media: async: Warn on attept to create an ancillary link to a non-subdev

Warn if a lens or a flash async sub-device is bound to a non-sub-device
notifier. This isn't meaningful and unlikely to happen in practice but
print a warning as we nevertheless won't consider this an error.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Convert to new CCI register access helpers
Luis Garcia [Wed, 1 May 2024 15:24:42 +0000 (09:24 -0600)]
media: i2c: imx258: Convert to new CCI register access helpers

Use the new comon CCI register access helpers to replace the private
register access helpers in the imx258 driver.

Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Use v4l2_link_freq_to_bitmap helper
Luis Garcia [Wed, 1 May 2024 15:24:41 +0000 (09:24 -0600)]
media: i2c: imx258: 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: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Make HFLIP and VFLIP controls writable
Dave Stevenson [Wed, 1 May 2024 15:24:37 +0000 (09:24 -0600)]
media: i2c: imx258: Make HFLIP and VFLIP controls writable

The sensor supports H & V flips, but the controls were READ_ONLY.

Note that the Bayer order changes with these flips, therefore
they set the V4L2_CTRL_FLAG_MODIFY_LAYOUT property.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Change register settings for variants of the sensor
Dave Stevenson [Wed, 1 May 2024 15:24:36 +0000 (09:24 -0600)]
media: i2c: imx258: Change register settings for variants of the sensor

Sony have advised that there are variants of the IMX258 sensor which
require slightly different register configuration to the mainline
imx258 driver defaults.

There is no available run-time detection for the variant, so add
configuration via the DT compatible string.

The Vision Components imx258 module supports PDAF, so add the
register differences for that variant

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agodt-bindings: media: imx258: Add alternate compatible strings
Dave Stevenson [Wed, 1 May 2024 15:24:35 +0000 (09:24 -0600)]
dt-bindings: media: imx258: Add alternate compatible strings

There are a number of variants of the imx258 modules that can not
be differentiated at runtime, so add compatible strings for the
PDAF variant.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
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>
13 months agodt-bindings: media: imx258: Rename to include vendor prefix
Dave Stevenson [Wed, 1 May 2024 15:24:34 +0000 (09:24 -0600)]
dt-bindings: media: imx258: Rename to include vendor prefix

imx258.yaml doesn't include the vendor prefix of sony, so
rename to add it.
Update the id entry and MAINTAINERS to match.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Support faster pixel rate on binned modes
Dave Stevenson [Wed, 1 May 2024 15:24:33 +0000 (09:24 -0600)]
media: i2c: imx258: Support faster pixel rate on binned modes

With the binned modes, there is little point in faithfully
reproducing the horizontal line length of 5352 pixels on the CSI2
bus, and the FIFO between the pixel array and MIPI serialiser
allows us to remove that dependency.

Allow the pixel array to run with the normal settings, with the MIPI
serialiser at half the rate. This requires some additional
information for the link frequency to pixel rate function that
needs to be added to the configuration tables.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Set pixel_rate range to the same as the value
Dave Stevenson [Wed, 1 May 2024 15:24:32 +0000 (09:24 -0600)]
media: i2c: imx258: Set pixel_rate range to the same as the value

With a read only control there is limited point in advertising
a minimum and maximum for the control, so change to set the
value, min, and max all to the selected pixel rate.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Issue reset before starting streaming
Dave Stevenson [Wed, 1 May 2024 15:24:31 +0000 (09:24 -0600)]
media: i2c: imx258: Issue reset before starting streaming

Whilst not documented, register 0x0103 bit 0 is the soft
reset for the sensor, so send it before trying to configure
the sensor.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Correct max FRM_LENGTH_LINES value
Dave Stevenson [Wed, 1 May 2024 15:24:30 +0000 (09:24 -0600)]
media: i2c: imx258: Correct max FRM_LENGTH_LINES value

The data sheet states that the maximum value for registers
0x0340/0x0341 FRM_LENGTH_LINES is 65525(decimal), not the
0xFFFF defined in this driver. Correct this limit.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Allow configuration of clock lane behaviour
Dave Stevenson [Wed, 1 May 2024 15:24:29 +0000 (09:24 -0600)]
media: i2c: imx258: Allow configuration of clock lane behaviour

The sensor supports the clock lane either remaining in HS mode
during frame blanking, or dropping to LP11.

Add configuration of the mode via V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Add get_selection for pixel array information
Dave Stevenson [Wed, 1 May 2024 15:24:28 +0000 (09:24 -0600)]
media: i2c: imx258: Add get_selection for pixel array information

Libcamera requires the cropping information for each mode, so
add this information to the driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure
Dave Stevenson [Wed, 1 May 2024 15:24:27 +0000 (09:24 -0600)]
media: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure

V4L2 sensor drivers are expected to clip the supported exposure
range based on the VBLANK configured.
IMX258 wasn't doing that as register 0x350 (FRM_LENGTH_CTL)
switches it to a mode where frame length tracks coarse exposure time.

Disable this mode and clip the range for V4L2_CID_EXPOSURE appropriately
based on V4L2_CID_VBLANK.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Add support for running on 2 CSI data lanes
Dave Stevenson [Wed, 1 May 2024 15:24:26 +0000 (09:24 -0600)]
media: i2c: imx258: Add support for running on 2 CSI data lanes

Extends the driver to also support 2 data lanes.
Frame rates are obviously more restricted on 2 lanes, but some
hardware simply hasn't wired more up.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Add support for 24MHz clock
Dave Stevenson [Wed, 1 May 2024 15:24:25 +0000 (09:24 -0600)]
media: i2c: imx258: Add support for 24MHz clock

There's no reason why only a clock of 19.2MHz is supported.
Indeed this isn't even a frequency listed in the datasheet.

Add support for 24MHz as well.
The PLL settings result in slightly different link frequencies,
so parameterise those.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Split out common registers from the mode based ones
Dave Stevenson [Wed, 1 May 2024 15:24:24 +0000 (09:24 -0600)]
media: i2c: imx258: Split out common registers from the mode based ones

Out of all the registers that are defined for each mode, only around
10 differ between the modes.

Split the table into common and mode specific ones.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Make V4L2_CID_VBLANK configurable.
Dave Stevenson [Wed, 1 May 2024 15:24:23 +0000 (09:24 -0600)]
media: i2c: imx258: Make V4L2_CID_VBLANK configurable.

The values and ranges of V4L2_CID_VBLANK are all computed,
so there is no reason for it to be a read only control.
Remove the register values from the mode lists, add the
handler, and remove the read only flag.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Add regulator control
Dave Stevenson [Wed, 1 May 2024 15:24:22 +0000 (09:24 -0600)]
media: i2c: imx258: Add regulator control

The device tree bindings define the relevant regulators for the
sensor, so update the driver to request the regulators and control
them at the appropriate times.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Remove redundant I2C writes.
Dave Stevenson [Wed, 1 May 2024 15:24:21 +0000 (09:24 -0600)]
media: i2c: imx258: Remove redundant I2C writes.

Registers 0x0202 and 0x0203 are written via the control handler
for V4L2_CID_EXPOSURE, so are not needed from the mode lists.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Disable digital cropping on binned modes
Dave Stevenson [Wed, 1 May 2024 15:24:20 +0000 (09:24 -0600)]
media: i2c: imx258: Disable digital cropping on binned modes

The binned modes set DIG_CROP_X_OFFSET and DIG_CROP_IMAGE_WIDTH
to less than the full image, even though the image being captured
is meant to be a scaled version of the full array size.

Reduce X_OFFSET to 0, and increase IMAGE_WIDTH to the full array.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Make image geometry meet sensor requirements
Dave Stevenson [Wed, 1 May 2024 15:24:19 +0000 (09:24 -0600)]
media: i2c: imx258: Make image geometry meet sensor requirements

The output image is defined as being 4208x3118 pixels in size.
Y_ADD_STA register was set to 0, and Y_ADD_END to 3118, giving
3119 lines total.

The datasheet lists a requirement for Y_ADD_STA to be a multiple
of a power of 2 depending on binning/scaling mode (2 for full pixel,
4 for x2-bin/scale, 8 for (x2-bin)+(x2-subsample) or x4-bin, or 16
for (x4-bin)+(x2-subsample)).
(Y_ADD_END â€“ Y_ADD_STA + 1) also has to be a similar power of 2.

The current configuration for the full res modes breaks that second
requirement, and we can't increase Y_ADD_STA to 1 to retain exactly
the same field of view as that then breaks the first requirement.
For the binned modes, they are worse off as 3118 is not a multiple of
4.

Increase the main mode to 4208x3120 so that it is the same FOV as the
binned modes, with Y_ADD_STA at 0.
Fix Y_ADD_STA and Y_ADD_END for the binned modes so that they meet the
sensor requirements.

This does change the Bayer order as the default configuration is for
H&V flips to be enabled, so readout is from Y_STA_END to Y_ADD_STA,
and this patch has changed Y_STA_END.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: imx258: Remove unused defines
Dave Stevenson [Wed, 1 May 2024 15:24:18 +0000 (09:24 -0600)]
media: i2c: imx258: Remove unused defines

The IMX258_FLL_* defines are unused. Remove them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luis Garcia <git@luigi311.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: v4l: async: Fix NULL pointer dereference in adding ancillary links
ChiYuan Huang [Wed, 8 May 2024 02:51:49 +0000 (10:51 +0800)]
media: v4l: async: Fix NULL pointer dereference in adding ancillary links

In v4l2_async_create_ancillary_links(), ancillary links are created for
lens and flash sub-devices. These are sub-device to sub-device links and
if the async notifier is related to a V4L2 device, the source sub-device
of the ancillary link is NULL, leading to a NULL pointer dereference.
Check the notifier's sd field is non-NULL in
v4l2_async_create_ancillary_links().

Fixes: aa4faf6eb271 ("media: v4l2-async: Create links during v4l2_async_match_notify()")
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
[Sakari Ailus: Reword the subject and commit messages slightly.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: hi846: Fix V4L2_SUBDEV_FORMAT_TRY get_selection()
Ricardo Ribalda [Thu, 9 May 2024 17:05:55 +0000 (17:05 +0000)]
media: i2c: hi846: Fix V4L2_SUBDEV_FORMAT_TRY get_selection()

The current code does not return anything to the user.

Although the code looks a bit dangerous (using a pointer without
checking if it is valid), it should be fine. The core validates that
sel->pad has a valid value.

Fix the following smatch error:
drivers/media/i2c/hi846.c:1854 hi846_get_selection() warn: statement has no effect 31

Fixes: e8c0882685f9 ("media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Sakari Ailus: code -> core.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: i2c: Fix imx412 exposure control
Bryan O'Donoghue [Thu, 9 May 2024 12:53:07 +0000 (13:53 +0100)]
media: i2c: Fix imx412 exposure control

Currently we have the following algorithm to calculate what value should be
written to the exposure control of imx412.

lpfr = imx412->vblank + imx412->cur_mode->height;
shutter = lpfr - exposure;

The 'shutter' value is given to IMX412_REG_EXPOSURE_CIT however, the above
algorithm will result in the value given to IMX412_REG_EXPOSURE_CIT
decreasing as the requested exposure value from user-space goes up.

e.g.
[ 2255.713989] imx412 20-001a: Received exp 1608, analog gain 0
[ 2255.714002] imx412 20-001a: Set exp 1608, analog gain 0, shutter 1938, lpfr 3546
[ 2256.302770] imx412 20-001a: Received exp 2586, analog gain 100
[ 2256.302800] imx412 20-001a: Set exp 2586, analog gain 100, shutter 960, lpfr 3546
[ 2256.753755] imx412 20-001a: Received exp 3524, analog gain 110
[ 2256.753772] imx412 20-001a: Set exp 3524, analog gain 110, shutter 22, lpfr 3546

This behaviour results in the image having less exposure as the requested
exposure value from user-space increases.

Other sensor drivers such as ov5675, imx218, hid556 and others take the
requested exposure value and use the value directly.

Take the example of the above cited sensor drivers and directly apply the
requested exposure value from user-space. The 'lpfr' variable still
functions as before but the 'shutter' variable can be dispensed with as a
result.

Once done a similar run of the test application requesting higher exposure
looks like this, with 'exp' written directly to the sensor.

[  133.207884] imx412 20-001a: Received exp 1608, analog gain 0
[  133.207899] imx412 20-001a: Set exp 1608, analog gain 0, lpfr 3546
[  133.905309] imx412 20-001a: Received exp 2844, analog gain 100
[  133.905344] imx412 20-001a: Set exp 2844, analog gain 100, lpfr 3546
[  134.241705] imx412 20-001a: Received exp 3524, analog gain 110
[  134.241775] imx412 20-001a: Set exp 3524, analog gain 110, lpfr 3546

The result is then setting the sensor exposure to lower values results in
darker, less exposure images and vice versa with higher exposure values.

Fixes: 9214e86c0cc1 ("media: i2c: Add imx412 camera sensor driver")
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # qrb5165-rb5/imx577
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <quic_grosikop@quicinc.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: ipu-bridge: add mod_devicetable.h header inclusion
Bingbu Cao [Fri, 10 May 2024 06:27:47 +0000 (14:27 +0800)]
media: ipu-bridge: add mod_devicetable.h header inclusion

ACPI_ID_LEN is defined in mod_devicetable.h, so the header should
be guaranteed to included in ipu-bridge.h instead of the source
files which include ipu-bridge.h.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: imon: Fix race getting ictx->lock
Ricardo Ribalda [Mon, 6 May 2024 21:10:27 +0000 (21:10 +0000)]
media: imon: Fix race getting ictx->lock

Lets fix a race between mutex_is_lock() and mutex_lock().

<-mutex is not locked
if (!mutex_is_locked(&ictx->lock)) {
unlock = true; <- mutex is locked externaly
mutex_lock(&ictx->lock);
}

Let's use mutex_trylock() that does mutex_is_lock() and mutex_lock()
atomically.

Fix the following cocci warning:
drivers/media/rc/imon.c:1167:1-7: preceding lock on line 1153

Fixes: 23ef710e1a6c ("[media] imon: add conditional locking in change_protocol")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()
Zheng Yejian [Thu, 9 May 2024 12:44:14 +0000 (20:44 +0800)]
media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()

Infinite log printing occurs during fuzz test:

  rc rc1: DViCO FusionHDTV DVB-T USB (LGZ201) as ...
  ...
  dvb-usb: schedule remote query interval to 100 msecs.
  dvb-usb: DViCO FusionHDTV DVB-T USB (LGZ201) successfully initialized ...
  dvb-usb: bulk message failed: -22 (1/0)
  dvb-usb: bulk message failed: -22 (1/0)
  dvb-usb: bulk message failed: -22 (1/0)
  ...
  dvb-usb: bulk message failed: -22 (1/0)

Looking into the codes, there is a loop in dvb_usb_read_remote_control(),
that is in rc_core_dvb_usb_remote_init() create a work that will call
dvb_usb_read_remote_control(), and this work will reschedule itself at
'rc_interval' intervals to recursively call dvb_usb_read_remote_control(),
see following code snippet:

  rc_core_dvb_usb_remote_init() {
    ...
    INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control);
    schedule_delayed_work(&d->rc_query_work,
                          msecs_to_jiffies(rc_interval));
    ...
  }

  dvb_usb_read_remote_control() {
    ...
    err = d->props.rc.core.rc_query(d);
    if (err)
      err(...)  // Did not return even if query failed
    schedule_delayed_work(&d->rc_query_work,
                          msecs_to_jiffies(rc_interval));
  }

When the infinite log printing occurs, the query callback
'd->props.rc.core.rc_query' is cxusb_rc_query(). And the log is due to
the failure of finding a valid 'generic_bulk_ctrl_endpoint'
in usb_bulk_msg(), see following code snippet:

  cxusb_rc_query() {
    cxusb_ctrl_msg() {
      dvb_usb_generic_rw() {
        ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
                           d->props.generic_bulk_ctrl_endpoint),...);
        if (ret)
          err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
          ...
      }
  ...
  }

By analyzing the corresponding USB descriptor, it shows that the
bNumEndpoints is 0 in its interface descriptor, but
the 'generic_bulk_ctrl_endpoint' is 1, that means user don't configure
a valid endpoint for 'generic_bulk_ctrl_endpoint', therefore this
'invalid' USB device should be rejected before it calls into
dvb_usb_read_remote_control().

To fix it, we need to add endpoint check for 'generic_bulk_ctrl_endpoint'.
And as Sean suggested, the same check and clear halts should be done for
'generic_bulk_ctrl_endpoint_response'. So introduce
dvb_usb_check_bulk_endpoint() to do it for both of them.

Fixes: 4d43e13f723e ("V4L/DVB (4643): Multi-input patch for DVB-USB device")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: mceusb: No need for vendor/product ID in name
Sean Young [Mon, 29 Apr 2024 13:04:36 +0000 (14:04 +0100)]
media: mceusb: No need for vendor/product ID in name

This is available in other places and doesn't belong in the name
of the rc device.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: tegra-vde: remove unused struct 'tegra_vde_h264_frame'
Dr. David Alan Gilbert [Thu, 30 May 2024 13:26:19 +0000 (14:26 +0100)]
media: tegra-vde: remove unused struct 'tegra_vde_h264_frame'

'tegra_vde_h264_frame' has been unused since
commit 313db7d235a0 ("media: staging: tegra-vde: Remove legacy UAPI
support").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: m2m-deinterlace: remove unused struct 'vb2_dc_conf'
Dr. David Alan Gilbert [Thu, 30 May 2024 13:26:18 +0000 (14:26 +0100)]
media: m2m-deinterlace: remove unused struct 'vb2_dc_conf'

'vb2_dc_conf' has been unused since the original
commit 8f0755c06b90 ("[media] media: Add mem2mem deinterlacing driver").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: amphion: remove unused struct 'vpu_malone_frame_buffer'
Dr. David Alan Gilbert [Thu, 30 May 2024 13:26:17 +0000 (14:26 +0100)]
media: amphion: remove unused struct 'vpu_malone_frame_buffer'

'vpu_malone_frame_buffer' has been unused since the original
commit 145e936380ed ("media: amphion: implement malone decoder rpc
interface").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agoDocumentation: media: Fix v4l2_ctrl_vp8_frame struct
Fritz Koenig [Wed, 29 May 2024 22:22:24 +0000 (15:22 -0700)]
Documentation: media: Fix v4l2_ctrl_vp8_frame struct

Description and control were out of sync.

Signed-off-by: Fritz Koenig <frkoenig@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: rockchip: rga: fix sequence number handling
Michael Tretter [Tue, 28 May 2024 14:05:14 +0000 (16:05 +0200)]
media: rockchip: rga: fix sequence number handling

The RGA driver didn't set the sequence numbers of the returned buffers.

Keep track of the CAPTURE and OUTPUT sequence numbers, and set the
sequence numbers in the source and destination buffers.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: pci/ivtv: Use managed version of pci_enable_device
Ricardo Ribalda [Mon, 27 May 2024 22:14:47 +0000 (22:14 +0000)]
media: pci/ivtv: Use managed version of pci_enable_device

If there is any error during probing, we should probably leave the
device in its previous state.

pcim_ will take care of this.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: pci/ivtv: Replace request_mem_region with devm_ variant
Ricardo Ribalda [Mon, 27 May 2024 22:14:46 +0000 (22:14 +0000)]
media: pci/ivtv: Replace request_mem_region with devm_ variant

The managed device resource version of the function greatly
simplifies the error handling.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: pci/ivtv: Replace ioremap with devm_ variants
Ricardo Ribalda [Mon, 27 May 2024 22:14:45 +0000 (22:14 +0000)]
media: pci/ivtv: Replace ioremap with devm_ variants

With Managed Device Resources the error handling is simpler.

The following smatch warning is silenced:
drivers/media/pci/ivtv/ivtv-driver.c: drivers/media/pci/ivtv/ivtv-driver.c:1296 ivtv_probe() warn: 'itv->dec_mem' from ioremap() not released on lines: 1296.
drivers/media/pci/ivtv/ivtv-driver.c: drivers/media/pci/ivtv/ivtv-driver.c:1296 ivtv_probe() warn: 'itv->enc_mem' from ioremap() not released on lines: 1296.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: siano: Use flex arrays for sms_firmware
Ricardo Ribalda [Mon, 27 May 2024 21:08:58 +0000 (21:08 +0000)]
media: siano: Use flex arrays for sms_firmware

Replace old style single array member, with flex array.

The struct is allocated, but it seems like there was an over allocation
error:

fw_buf = kmalloc(ALIGN(fw->size + sizeof(struct sms_firmware),
SMS_ALLOC_ALIGNMENT), GFP_KERNEL | coredev->gfp_buf_flags);

This change fixes this cocci warning:
drivers/media/common/siano/smscoreapi.h:669:6-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: siano: Remove unused structures
Ricardo Ribalda [Mon, 27 May 2024 21:08:57 +0000 (21:08 +0000)]
media: siano: Remove unused structures

These structs are not used in the code, remove them.

This fixes the following cocci warning:

drivers/media/common/siano/smscoreapi.h:1049:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/common/siano/smscoreapi.h:1055:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: siano: Refactor struct sms_msg_data
Ricardo Ribalda [Mon, 27 May 2024 21:08:56 +0000 (21:08 +0000)]
media: siano: Refactor struct sms_msg_data

Replace a single element array with a single element field.

The endianness conversion code seems to support multiple elements. To
avoid changing behavior a pointer to the single element has been used.

This is safer than moving to a flex array, because in that case the
structure size changes.

This fixes the following cocci warning:
drivers/media/common/siano/smscoreapi.h:619:5-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: pci: cx18: Use flex arrays for struct cx18_scb
Ricardo Ribalda [Mon, 27 May 2024 21:08:55 +0000 (21:08 +0000)]
media: pci: cx18: Use flex arrays for struct cx18_scb

Replace the old-style single element array with a flexible array.
This structure does not seem to be allocated in the code, so there is no
need to change anything else.

The following cocci warning is fixed:
drivers/media/pci/cx18/cx18-scb.h:261:22-29: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: xilinx: Refactor struct xvip_dma
Ricardo Ribalda [Mon, 27 May 2024 21:08:52 +0000 (21:08 +0000)]
media: xilinx: Refactor struct xvip_dma

Replace a single element array with a single field.

The following cocci warning is fixed:
drivers/media/platform/xilinx/xilinx-dma.h:100:19-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: allegro: nal-hevc: Replace array[1] with array[N]
Ricardo Ribalda [Mon, 27 May 2024 21:08:51 +0000 (21:08 +0000)]
media: allegro: nal-hevc: Replace array[1] with array[N]

Structures that have a single element array as the last field can be
mistaken as a "flex array".

We could replace all the single element arrays in the structure with
single element fields, but this driver prefers to follow the ITU-T H.265
specification, which defines it as an array.

If we introduce a new define N_HRD_PARAMS, we make clear our
intentions.

This fixes this cocci warning:
drivers/media/platform/allegro-dvt/nal-hevc.h:102:14-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: fix typo in subject and commit log]

13 months agomedia: pvrusb2: remove unused struct 'debugifc_mask_item'
Dr. David Alan Gilbert [Sat, 25 May 2024 17:52:29 +0000 (18:52 +0100)]
media: pvrusb2: remove unused struct 'debugifc_mask_item'

'debugifc_mask_item' is unused since
commit 681c73994401 ("V4L/DVB (6691): pvrusb2: Rework pipeline state
control").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: opera1: remove unused struct 'rc_map_opera_table'
Dr. David Alan Gilbert [Sat, 25 May 2024 17:52:28 +0000 (18:52 +0100)]
media: opera1: remove unused struct 'rc_map_opera_table'

'rc_map_opera_table' has been unused since
commit 2f4f58d689dd ("[media] rc: Name RC keymap tables as
rc_map_table").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: gs1662: remove unused struct 'gs_reg_fmt_custom'
Dr. David Alan Gilbert [Sat, 25 May 2024 17:52:27 +0000 (18:52 +0100)]
media: gs1662: remove unused struct 'gs_reg_fmt_custom'

'gs_reg_fmt_custom' is unused since the original
commit 7aae6e2df127 ("[media] Add GS1662 driver, a video
serializer").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dvb-frontends: dib7000p: remove unused struct 'i2c_device'
Dr. David Alan Gilbert [Fri, 24 May 2024 00:29:16 +0000 (01:29 +0100)]
media: dvb-frontends: dib7000p: remove unused struct 'i2c_device'

'i2c_device' was added by the original
commit 713d54a8bd81 ("[media] DiB7090: add support for the dib7090
based")
but is unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dvb-frontends: stv0910: remove unused struct 'sinit_table'
Dr. David Alan Gilbert [Fri, 24 May 2024 00:29:15 +0000 (01:29 +0100)]
media: dvb-frontends: stv0910: remove unused struct 'sinit_table'

'sinit_table' has been unused since the original
commit cd21b3349437 ("media: dvb-frontends: add ST STV0910 DVB-S/S2
demodulator frontend driver").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dvb-frontends: drx39xyj: remove unused struct 'drxjeq_stat'
Dr. David Alan Gilbert [Fri, 24 May 2024 00:29:14 +0000 (01:29 +0100)]
media: dvb-frontends: drx39xyj: remove unused struct 'drxjeq_stat'

'drxjeq_stat' is unused since the original
commit 38b2df95c53b ("[media] drx-j: add a driver for Trident drx-j
frontend").
The name was changed by
commit 57afe2f0bb0c ("[media] drx-j: Don't use CamelCase")
and it was originally DRXJEQStat_t.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: go7007: Refactor Adlink PCI-MPG24 i2c mutex
Ricardo Ribalda [Mon, 6 May 2024 21:10:29 +0000 (21:10 +0000)]
media: go7007: Refactor Adlink PCI-MPG24 i2c mutex

Move the lock/unlock to its own function. It makes the code cleaner and
cocci happier.

Fix the following cocci warning:
drivers/media/usb/go7007/go7007-i2c.c:125:1-7: preceding lock on line 61

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: dvb-frontends/stv090x: Refactor tuner_i2c_lock
Ricardo Ribalda [Mon, 6 May 2024 21:10:28 +0000 (21:10 +0000)]
media: dvb-frontends/stv090x: Refactor tuner_i2c_lock

Move the lock logic to it's own function. There is less code duplication
and cocci is much happier.

Fix the following cocci warning:
drivers/media/dvb-frontends/stv090x.c:799:1-7: preceding lock on line 768

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: ivtv: Factor out schedule functions
Ricardo Ribalda [Mon, 6 May 2024 21:10:26 +0000 (21:10 +0000)]
media: ivtv: Factor out schedule functions

Cocci is very confused by unlock-lock a mutex in the middle of a
function.

Factor the schedules out, avoid code duplication and make cocci a bit
happier.

Fix the following cocci warnings:
drivers/media/pci/ivtv/ivtv-fileops.c:223:4-10: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:230:3-9: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:236:4-10: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:245:3-9: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:251:3-9: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:257:3-9: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:272:3-9: preceding lock on line 267
drivers/media/pci/ivtv/ivtv-fileops.c:598:4-10: preceding lock on line 627
drivers/media/pci/ivtv/ivtv-fileops.c:598:4-10: preceding lock on line 689
drivers/media/pci/ivtv/ivtv-fileops.c:606:3-9: preceding lock on line 627
drivers/media/pci/ivtv/ivtv-fileops.c:606:3-9: preceding lock on line 689
drivers/media/pci/ivtv/ivtv-fileops.c:648:3-9: preceding lock on line 627
drivers/media/pci/ivtv/ivtv-fileops.c:648:3-9: preceding lock on line 689
drivers/media/pci/ivtv/ivtv-fileops.c:692:4-10: preceding lock on line 689

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agomedia: pci: ivtv: Add check for DMA map result
Mikhail Kobuk [Wed, 27 Mar 2024 23:32:23 +0000 (02:32 +0300)]
media: pci: ivtv: Add check for DMA map result

In case DMA fails, 'dma->SG_length' is 0. This value is later used to
access 'dma->SGarray[dma->SG_length - 1]', which will cause out of
bounds access.

Add check to return early on invalid value. Adjust warnings accordingly.

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

Fixes: 1932dc2f4cf6 ("media: pci/ivtv: switch from 'pci_' to 'dma_' API")
Signed-off-by: Mikhail Kobuk <m.kobuk@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
13 months agodt-bindings: media: rockchip-rga: add rockchip,rk3588-rga
Jianfeng Liu [Fri, 22 Mar 2024 05:29:14 +0000 (13:29 +0800)]
dt-bindings: media: rockchip-rga: add rockchip,rk3588-rga

Add a new compatible for the rk3588 Rockchip SoC, which also features an
RGA, which is called RGA2 in the TRM Part2. It is the same core as used
on the rk3288 and rk3568, which documents the same RGA2.

Signed-off-by: Jianfeng Liu <liujianfeng1994@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
14 months agoLinux 6.10-rc1
Linus Torvalds [Sun, 26 May 2024 22:20:12 +0000 (15:20 -0700)]
Linux 6.10-rc1