]> www.infradead.org Git - users/dwmw2/linux.git/log
users/dwmw2/linux.git
12 months agomedia: atomisp: Add atomisp_select_input() helper
Hans de Goede [Thu, 11 Apr 2024 17:56:47 +0000 (18:56 +0100)]
media: atomisp: Add atomisp_select_input() helper

When switching input/sensor the s_power() callback must be called
for old sensor drivers to power on the new sensor and power off
the previous sensor.

atomisp_s_input() already does this but atomisp_link_setup()
did not do this.

Add a new atomisp_select_input() helper which does this and use this
in both atomisp_s_input() and atomisp_link_setup() for consistent
behavior.

Also make atomisp_link_setup() turn the sensor back off when
a link gets disabled.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Turn on sensor power from atomisp_set_fmt()
Hans de Goede [Thu, 11 Apr 2024 18:07:55 +0000 (19:07 +0100)]
media: atomisp: Turn on sensor power from atomisp_set_fmt()

ATM the atomisp driver does not call s_power() at all when no s_input
ioctl() is done by the application. This breaks older sensor drivers
which rely on s_power() for power-management.

Some drivers have worked around this, e.g. commit c5fafbadaeae ("media:
atomisp: gc0310: Power on sensor from set_fmt() callback") and
commit b3118a942c82 ("media: atomisp: ov2722: Power on sensor from
set_fmt() callback"), but this really should be fixed in the atomisp
driver itself, so that all old drivers can work.

A logical place to call s_power() would be from atomisp_start_streaming() /
atomisp_stop_streaming(). But some older drivers, e.g. the atomisp-ov2722
driver already write mode related registers on set_fmt() instead of waiting
on stream on. So the s_power(1) needs to happen at the first set_fmt().

Add an atomisp_s_sensor_power(..., 1) call just before calling set_fmt()
for this. If the power was already enabled through e.g. a s_input ioctl
atomisp_s_sensor_power() will skip calling the s_power() v4l2-subdev-op
a second time.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Add atomisp_s_sensor_power() helper
Hans de Goede [Thu, 11 Apr 2024 17:42:16 +0000 (18:42 +0100)]
media: atomisp: Add atomisp_s_sensor_power() helper

Since the atomisp driver only supports 1 stream / only has 1 asd now,
there is no longer a need to track which stream owns the sensor.

So the asd owner-pointer of struct atomisp_input_subdev can be dropped,
replace this with a simple camera_on boolean and add a new
atomisp_s_sensor_power() helper which takes care of avoiding unbalanced
s_power() subdev calls as well as takes care of handling the special
-ENOIOCTLCMD return for subdevs which don't implement s_power().

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Get rid of PCI device ID hack check
Andy Shevchenko [Tue, 2 Apr 2024 20:44:47 +0000 (21:44 +0100)]
media: atomisp: Get rid of PCI device ID hack check

Always check exact PCI ID match and drop hack checks.

Link: https://lore.kernel.org/r/20240402204447.294280-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Replace open-coded i2c_find_device_by_fwnode()
Andy Shevchenko [Wed, 10 Apr 2024 10:32:11 +0000 (11:32 +0100)]
media: atomisp: Replace open-coded i2c_find_device_by_fwnode()

gmin_i2c_dev_exists() is using open-coded variant of
i2c_find_device_by_fwnode(). Replace it with a corresponding call.

Link: https://lore.kernel.org/r/20240326202813.1425431-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Put PMIC device after getting its I²C address
Andy Shevchenko [Tue, 26 Mar 2024 20:27:02 +0000 (20:27 +0000)]
media: atomisp: Put PMIC device after getting its I²C address

We don't use the PMIC I²C client device after getting its address.
Drop the reference to it. We do not expect device to disappear
as it should be taken care by the OpRegion drivers.

Link: https://lore.kernel.org/r/20240326202813.1425431-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Remove unsused macros
Andy Shevchenko [Tue, 26 Mar 2024 19:09:03 +0000 (19:09 +0000)]
media: atomisp: Remove unsused macros

Entire defs.h can be killed, so do that.
Also kill same macro definitions in hive_types.h

Link: https://lore.kernel.org/r/20240326190903.1422069-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Remove extra whitespace after opening parentheses
Jonathan Bergh [Tue, 27 Feb 2024 16:30:42 +0000 (16:30 +0000)]
media: staging: media: atomisp: Remove extra whitespace after opening parentheses

This patch makes the following changes:
 * Removes spurious whitespace after the opening parentheses as per code
   style guidelines

Link: https://lore.kernel.org/r/20240227163043.112162-2-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Fix various multiline block comment formatting instances
Jonathan Bergh [Tue, 27 Feb 2024 16:30:41 +0000 (16:30 +0000)]
media: staging: media: atomisp: Fix various multiline block comment formatting instances

This patch makes the following fixes:
 * Reformats a number of multiline block comments to ensure * and */ align
   correctly

Link: https://lore.kernel.org/r/20240227163043.112162-1-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Remove old commented code and fix multiple block...
Jonathan Bergh [Mon, 26 Feb 2024 19:40:23 +0000 (19:40 +0000)]
media: staging: media: atomisp: Remove old commented code and fix multiple block comment style

This patch fixes the following minor code and code style issues:
 * Removes a block of commented out (unused) code from the src
 * Reformats various multiline block comments to meet the kernel code
   style guidelines for block comments

Link: https://lore.kernel.org/r/20240226194023.69070-7-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Remove unneeded return statement from void function
Jonathan Bergh [Mon, 26 Feb 2024 19:40:22 +0000 (19:40 +0000)]
media: staging: media: atomisp: Remove unneeded return statement from void function

This patch makes the following change:
 * Removes an unnecessary 'return' statement from a void function
   implementation

Link: https://lore.kernel.org/r/20240226194023.69070-6-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Remove unnecessary parentheses from conditional statement
Jonathan Bergh [Mon, 26 Feb 2024 19:40:21 +0000 (19:40 +0000)]
media: staging: media: atomisp: Remove unnecessary parentheses from conditional statement

This patch makes the following changes:
 * Removes additional, unnecessary parentheses from a conditional "if"
   statement

Link: https://lore.kernel.org/r/20240226194023.69070-5-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Ensure trailing statements are on a newline and remov...
Jonathan Bergh [Mon, 26 Feb 2024 19:40:20 +0000 (19:40 +0000)]
media: staging: media: atomisp: Ensure trailing statements are on a newline and remove spurious whitespaces

This patch fixes the following minor code style issues:
 * Ensure trailing statements are located on a newline
 * Removes an instance of a spurious whitespace following a conditional
   statement

Link: https://lore.kernel.org/r/20240226194023.69070-4-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Fixed "unsigned int *" rather than "unsigned *" decla...
Jonathan Bergh [Mon, 26 Feb 2024 19:40:19 +0000 (19:40 +0000)]
media: staging: media: atomisp: Fixed "unsigned int *" rather than "unsigned *" declaration in variable declaration

This code fixes a code style issue where:
 * Checkpatch suggests using "unsigned int *" rather than a bare
   "unsigned *" declaration in the code

Link: https://lore.kernel.org/r/20240226194023.69070-3-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Remove unnecessary braces from single line conditiona...
Jonathan Bergh [Mon, 26 Feb 2024 19:40:18 +0000 (19:40 +0000)]
media: staging: media: atomisp: Remove unnecessary braces from single line conditional statements

This patch does the following things:
 * Tidies up code in several places where braces were used in conjunction
   with single line conditional statements

Link: https://lore.kernel.org/r/20240226194023.69070-2-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Fix formatting issues and minor code issue
Jonathan Bergh [Sun, 25 Feb 2024 15:53:59 +0000 (15:53 +0000)]
media: staging: media: atomisp: Fix formatting issues and minor code issue

This patch fixes the following code style and formatting issues:
 * Ensure multiline block comments are correctly formatted
 * Remove extra braces not required for single line conditional statements

Link: https://lore.kernel.org/r/20240225155359.41435-1-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: staging: media: atomisp: Fix various formatting issues and remove unneccesary...
Jonathan Bergh [Sun, 25 Feb 2024 12:03:50 +0000 (12:03 +0000)]
media: staging: media: atomisp: Fix various formatting issues and remove unneccesary braces

This patch fixes the following formatting issues:
 * Fix various misaligned * and */ in multiline block comments
 * Remove unnecessary braces from single line conditional statements
 * Remove repeated word "from" from comment

Link: https://lore.kernel.org/r/20240225120350.31226-1-bergh.jonathan@gmail.com
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Initialize sequence counters to 0 instead of -1
Hans de Goede [Sun, 17 Mar 2024 21:45:25 +0000 (21:45 +0000)]
media: atomisp: Initialize sequence counters to 0 instead of -1

When starting a new stream initialize the sequence counters to 0
instead of -1. This fixes the following libcamera warning:

 Zero sequence expected for first frame (got 4294967295)

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Disable broken V4L2_PIX_FMT_RGBX32 output support
Hans de Goede [Sat, 16 Mar 2024 21:53:06 +0000 (21:53 +0000)]
media: atomisp: Disable broken V4L2_PIX_FMT_RGBX32 output support

Disable V4L2_PIX_FMT_RGBX32 support, because it is broken.

Selecting V4L2_PIX_FMT_RGBX32 output shows vertical columns with random
data. For each 128 pixels in a row the last 28 (32?) or so pixels contain
random data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Replace V4L2_PIX_FMT_RGB32 with V4L2_PIX_FMT_RGBX32
Hans de Goede [Sat, 16 Mar 2024 21:48:30 +0000 (21:48 +0000)]
media: atomisp: Replace V4L2_PIX_FMT_RGB32 with V4L2_PIX_FMT_RGBX32

V4L2_PIX_FMT_RGB32 is deprecated because its definition never made
clear if the 4th byte was alpha data or unused. Instead either
V4L2_PIX_FMT_ARGB32 or V4L2_PIX_FMT_RGBX32 should be used.

V4L2_PIX_FMT_RGB32 internally is mapped to IA_CSS_FRAME_FORMAT_RGBA888
and ia_css_frame_format.h says that the alpha bits there are unused,
so replace V4L2_PIX_FMT_RGB32 with V4L2_PIX_FMT_RGBX32.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: atomisp: Drop second V4L2_PIX_FMT_UYVY atomisp_output_fmts[] entry
Hans de Goede [Sat, 16 Mar 2024 21:41:29 +0000 (21:41 +0000)]
media: atomisp: Drop second V4L2_PIX_FMT_UYVY atomisp_output_fmts[] entry

Some userspace apps (e.g. libcamera) do not like it if the enum_fmts
ioctl returns the same fmt twice. Drop the second "do not use"
V4L2_PIX_FMT_UYVY entry for parallel sensors to fix this.

The current atomisp code does not support anything other then raw bayer
sensors anyways, so dropping this is not an issue.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
12 months agomedia: stk1160: fix bounds checking in stk1160_copy_video()
Dan Carpenter [Mon, 22 Apr 2024 09:32:44 +0000 (12:32 +0300)]
media: stk1160: fix bounds checking in stk1160_copy_video()

The subtract in this condition is reversed.  The ->length is the length
of the buffer.  The ->bytesused is how many bytes we have copied thus
far.  When the condition is reversed that means the result of the
subtraction is always negative but since it's unsigned then the result
is a very high positive value.  That means the overflow check is never
true.

Additionally, the ->bytesused doesn't actually work for this purpose
because we're not writing to "buf->mem + buf->bytesused".  Instead, the
math to calculate the destination where we are writing is a bit
involved.  You calculate the number of full lines already written,
multiply by two, skip a line if necessary so that we start on an odd
numbered line, and add the offset into the line.

To fix this buffer overflow, just take the actual destination where we
are writing, if the offset is already out of bounds print an error and
return.  Otherwise, write up to buf->length bytes.

Fixes: 9cb2173e6ea8 ("[media] media: Add stk1160 new driver (easycap replacement)")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: dt-bindings: nxp,imx8-jpeg: Add clocks entries
Fabio Estevam [Mon, 8 Apr 2024 12:06:53 +0000 (15:06 +0300)]
media: dt-bindings: nxp,imx8-jpeg: Add clocks entries

The JPEG decoder/encoder present in iMX8QXP and iMX8QM SoCs need
the PER and IPG clocks to be functional, so add the clock entries.

This also fixes the following schema warning:

imx8qm-apalis-eval.dtb: jpegdec@58400000: 'assigned-clock-rates', 'assigned-clocks', 'clock-names', 'clocks' do not match any of the regexes: 'pinctrl-[0-9]+'
        from schema $id: http://devicetree.org/schemas/media/nxp,imx8-jpeg.yaml#

Signed-off-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: videobuf2: improve max_num_buffers sanity checks
Hans Verkuil [Mon, 18 Mar 2024 14:29:33 +0000 (15:29 +0100)]
media: videobuf2: improve max_num_buffers sanity checks

Ensure that drivers set max_num_buffers to a value >= 32.
For now there is no reason for drivers to request a lower
limit and doing so might potentially cause userspace issues.
Note that the old check of > MAX_BUFFER_INDEX was pointless
since q->max_num_buffers was already limited to MAX_BUFFER_INDEX
or less.

Also add a sanity check in __vb2_init_fileio(), returning
-ENOSPC if a driver returns more than 32 buffers from
VIDIOC_REQBUFS with count = q->min_reqbufs_allocation.

The vb2_fileio_data struct only supports up to 32 buffers,
so we need a check there.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agodoc: media: v4l/func-open.rst: ENXIO should be ENODEV
Hans Verkuil [Fri, 23 Feb 2024 09:15:20 +0000 (10:15 +0100)]
doc: media: v4l/func-open.rst: ENXIO should be ENODEV

The error that V4L2 returns when an attempt is made to open an
unregisted device node is ENODEV, no ENXIO. Update the documentation.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: cec: return -ENODEV instead of -ENXIO if unregistered
Hans Verkuil [Fri, 23 Feb 2024 09:08:47 +0000 (10:08 +0100)]
media: cec: return -ENODEV instead of -ENXIO if unregistered

If the CEC device is unregistered, then an attempt to open
the device node should result in an -ENODEV error instead of
-ENXIO.

Document this as well in cec-func-open.rst.

This is consistent with the error code returned by other
file operations such as ioctl.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: v4l2-core: hold videodev_lock until dev reg, finishes
Hans Verkuil [Fri, 23 Feb 2024 08:45:36 +0000 (09:45 +0100)]
media: v4l2-core: hold videodev_lock until dev reg, finishes

After the new V4L2 device node was registered, some additional
initialization was done before the device node was marked as
'registered'. During the time between creating the device node
and marking it as 'registered' it was possible to open the
device node, which would return -ENODEV since the 'registered'
flag was not yet set.

Hold the videodev_lock mutex from just before the device node
is registered until the 'registered' flag is set. Since v4l2_open
will take the same lock, it will wait until this registration
process is finished. This resolves this race condition.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org> # for vi4.18 and up
12 months agoMerge tag 'tags/media-next-uvc-20240419' of git://git.kernel.org/pub/scm/linux/kernel...
Hans Verkuil [Mon, 22 Apr 2024 11:32:03 +0000 (13:32 +0200)]
Merge tag 'tags/media-next-uvc-20240419' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git into media_stage

uvcvideo fixes:

Ricardo Ribalda (3):
      media: uvcvideo: Add quirk for Logitech Rally Bar
      media: uvcvideo: Fix power line control for Shine-Optics Camera
      media: uvcvideo: Disable autosuspend for Insta360 Link

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.linuxtv.org/project/linux-media/patch/20240419125149.GA2125@pendragon.ideasonboard.com/
12 months agomedia: imx335: Describe CCI struct member
Umang Jain [Mon, 22 Apr 2024 10:42:47 +0000 (16:12 +0530)]
media: imx335: Describe CCI struct member

Add description for 'struct regmap *cci' member of struct imx335.

This will fix the following compile-time warning:
warning: Function parameter or struct member 'cci' not described in 'imx335'

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: hi556: Add support for avdd regulator
Hans de Goede [Mon, 15 Apr 2024 13:10:38 +0000 (15:10 +0200)]
media: hi556: Add support for avdd regulator

On some ACPI platforms, such as Chromebooks the ACPI methods to
change the power-state (_PS0 and _PS3) fully take care of powering
on/off the sensor.

On other ACPI platforms, such as e.g. various HP models with IPU6 +
hi556 sensor, the sensor driver must control the avdd regulator itself.

Add support for having the driver control the sensor's avdd regulator.
Note this relies on the regulator-core providing a dummy regulator
(which it does by default) on platforms where Linux is not aware of
the avdd regulator.

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>
12 months agomedia: hi556: Add support for external clock
Hans de Goede [Mon, 15 Apr 2024 13:10:37 +0000 (15:10 +0200)]
media: hi556: Add support for external clock

On some ACPI platforms, such as Chromebooks the ACPI methods to
change the power-state (_PS0 and _PS3) fully take care of powering
on/off the sensor.

On other ACPI platforms, such as e.g. various HP models with IPU6 +
hi556 sensor, the sensor driver must control the sensor's clock itself.

Add support for having the driver control an optional clock.

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>
12 months agomedia: hi556: Add support for reset GPIO
Hans de Goede [Mon, 15 Apr 2024 13:10:36 +0000 (15:10 +0200)]
media: hi556: Add support for reset GPIO

On some ACPI platforms, such as Chromebooks the ACPI methods to
change the power-state (_PS0 and _PS3) fully take care of powering
on/off the sensor.

On other ACPI platforms, such as e.g. various HP models with IPU6 +
hi556 sensor, the sensor driver must control the reset GPIO itself.

Add support for having the driver control an optional reset GPIO.

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>
12 months agomedia: hi556: Return -EPROBE_DEFER if no endpoint is found
Hans de Goede [Mon, 15 Apr 2024 13:10:35 +0000 (15:10 +0200)]
media: hi556: Return -EPROBE_DEFER if no endpoint is found

With ipu bridge, endpoints may only be created when ipu bridge has
initialised. This may happen after the sensor driver has first probed.

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>
12 months agomedia: ov2680: Add camera orientation and sensor rotation controls
Hans de Goede [Mon, 15 Apr 2024 13:03:18 +0000 (15:03 +0200)]
media: ov2680: Add camera orientation and sensor rotation controls

Add camera orientation and sensor rotation controls using
the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties()
helpers.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
12 months agomedia: ov2680: Add hblank control
Hans de Goede [Mon, 15 Apr 2024 13:03:17 +0000 (15:03 +0200)]
media: ov2680: Add hblank control

Add hblank control so that the sensor has all the mandatory
controls for libcamera.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
12 months agomedia: ov2680: Add vblank control
Hans de Goede [Mon, 15 Apr 2024 13:03:16 +0000 (15:03 +0200)]
media: ov2680: Add vblank control

Add vblank control to allow changing the framerate /
higher exposure values.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
12 months agomedia: ov2680: Drop hts, vts ov2680_mode struct members
Hans de Goede [Mon, 15 Apr 2024 13:03:15 +0000 (15:03 +0200)]
media: ov2680: Drop hts, vts ov2680_mode struct members

The hts, vts ov2680_mode struct members always contain
OV2680_PIXELS_PER_LINE resp. OV2680_LINES_PER_FRAME,
drop them and simply use these values directly.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
12 months agomedia: ov2680: Stop sending more data then requested
Hans de Goede [Mon, 15 Apr 2024 13:03:14 +0000 (15:03 +0200)]
media: ov2680: Stop sending more data then requested

There is no reason to send OV2680_END_MARGIN extra columns on top of
the mode width and the same for sending extra lines over the mode height.

This sending of extra lines/columns was inherited from the atomisp
ov2680 driver, it is unclear why this was done and this complicates
adding V4L2_CID_VBLANK support, so remove it.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
12 months agomedia: ov2680: Do not fail if data-lanes property is absent
Fabio Estevam [Sun, 14 Apr 2024 21:09:06 +0000 (18:09 -0300)]
media: ov2680: Do not fail if data-lanes property is absent

Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
property verification") the ov2680 driver no longer probes when the
'data-lanes' property is absent.

The OV2680 sensor has only one data lane, so there is no need for
describing it the devicetree.

Remove the unnecessary data-lanes property check.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
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>
12 months agomedia: imx335: Limit analogue gain value
Umang Jain [Sun, 14 Apr 2024 14:06:21 +0000 (19:36 +0530)]
media: imx335: Limit analogue gain value

The sensor gain (both analog and digital) are controlled by a
single gain value where:
- 0dB to 30dB correspond to analog gain
- 30.3dB to 72dB correspond to digital gain
  (with 0.3dB step)

Hence, limit the analogue gain value to 100.
For digital gain, support can be added later if needed.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
12 months agomedia: imx335: Fix active area height discrepency
Umang Jain [Sun, 14 Apr 2024 14:06:20 +0000 (19:36 +0530)]
media: imx335: Fix active area height discrepency

The imx335 reports a recommended pixel area of - 2592x1944.
The driver supported mode however limits it to height=1940.

Fix the height discrepency by correctly the value of height
(with updates to vblank and mode registers).

The IMX335_REG_HTRIMMING should also be corrected to the start
offset(i.e. 48) instead of chosing a abritrary crop start of 384.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: imx335: Use integer values for size registers
Umang Jain [Sun, 14 Apr 2024 14:06:19 +0000 (19:36 +0530)]
media: imx335: Use integer values for size registers

Consider integer values for registers that are related to various
sizes in the register map. This helps in improving the overall
readability.

No functional changes intended in this patch.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: imx335: Use V4L2 CCI for accessing sensor registers
Umang Jain [Sun, 14 Apr 2024 14:06:18 +0000 (19:36 +0530)]
media: imx335: Use V4L2 CCI for accessing sensor registers

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

Select V4L2_CCI_I2C Kconfig option which the imx335 driver now
depends on.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: imx335: Parse fwnode properties
Kieran Bingham [Sun, 14 Apr 2024 14:06:17 +0000 (19:36 +0530)]
media: imx335: Parse fwnode properties

Call the V4L2 fwnode device parser to handle controls that are
standardised by the framework.

Signed-off-by: Kieran Bingham <kieran.bingham@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>
12 months agomedia: imx335: Support 2 or 4 lane operation modes
Kieran Bingham [Sun, 14 Apr 2024 14:06:16 +0000 (19:36 +0530)]
media: imx335: Support 2 or 4 lane operation modes

The IMX335 can support both 2 and 4 lane configurations.
Extend the driver to configure the lane mode accordingly.
Update the pixel rate depending on the number of lanes in use.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.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>
[hverkuil: fixup missing : in @lane_mode kerneldoc line]

12 months agomedia: v4l2-ctrls: Return handler error in creating new fwnode properties
Sakari Ailus [Fri, 12 Apr 2024 12:56:49 +0000 (15:56 +0300)]
media: v4l2-ctrls: Return handler error in creating new fwnode properties

If the control handler is in an error state, return that error immediately
in v4l2_ctrl_new_fwnode_properties(). Effectively the change here is that
the same error code (handler's error) is returned in all cases instead of
possibly returning -EINVAL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: staging: ipu3-imgu: Update firmware path
Sakari Ailus [Thu, 11 Apr 2024 06:54:04 +0000 (09:54 +0300)]
media: staging: ipu3-imgu: Update firmware path

Use the current firmware path in linux-firmware repository. Check the
older paths still in order to avoid causing issues to the users.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: v4l: Don't turn on privacy LED if streamon fails
Sakari Ailus [Wed, 10 Apr 2024 09:58:44 +0000 (12:58 +0300)]
media: v4l: Don't turn on privacy LED if streamon fails

Turn on the privacy LED only if streamon succeeds. This can be done after
enabling streaming on the sensor.

Fixes: b6e10ff6c23d ("media: v4l2-core: Make the v4l2-core code enable/disable the privacy LED if present")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: ti: j721e-csi2rx: Fix races while restarting DMA
Jai Luthra [Fri, 23 Feb 2024 08:23:02 +0000 (13:53 +0530)]
media: ti: j721e-csi2rx: Fix races while restarting DMA

After the frame is submitted to DMA, it may happen that the submitted
list is not updated soon enough, and the DMA callback is triggered
before that.

This can lead to kernel crashes, so move everything in a single
lock/unlock section to prevent such races.

Fixes: b4a3d877dc92 ("media: ti: Add CSI2RX support for J721E")
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: cadence: csi2rx: configure DPHY before starting source stream
Pratyush Yadav [Fri, 23 Feb 2024 08:23:01 +0000 (13:53 +0530)]
media: cadence: csi2rx: configure DPHY before starting source stream

When the source device is operating above 1.5 Gbps per lane, it needs to
send the Skew Calibration Sequence before sending any HS data. If the
DPHY is initialized after the source stream is started, then it might
miss the sequence and not be able to receive data properly. Move the
start of source subdev to the end of the sequence to make sure
everything is ready to receive data before the source starts streaming.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Fixes: 3295cf1241d3 ("media: cadence: Add support for external dphy")
Tested-by: Julien Massot <julien.massot@collabora.com>
Tested-by: Changhuang Liang <Changhuang.liang@starfivetech.com>
Reviewed-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Changhuang Liang <Changhuang.liang@starfivetech.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: mc: mark the media devnode as registered from the, start
Hans Verkuil [Fri, 23 Feb 2024 08:46:19 +0000 (09:46 +0100)]
media: mc: mark the media devnode as registered from the, start

First the media device node was created, and if successful it was
marked as 'registered'. This leaves a small race condition where
an application can open the device node and get an error back
because the 'registered' flag was not yet set.

Change the order: first set the 'registered' flag, then actually
register the media device node. If that fails, then clear the flag.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Fixes: cf4b9211b568 ("[media] media: Media device node support")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
12 months agomedia: dt-bindings: i2c: use absolute path to other schema
Alexander Stein [Fri, 1 Mar 2024 08:40:08 +0000 (09:40 +0100)]
media: dt-bindings: i2c: use absolute path to other schema

Absolute path to other DT schema is preferred over relative one.

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+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agomedia: dt-bindings: sony,imx290: Allow props from video-interface-devices
Alexander Stein [Fri, 1 Mar 2024 08:40:07 +0000 (09:40 +0100)]
media: dt-bindings: sony,imx290: Allow props from video-interface-devices

Allow properties from video-interface-devices. This aligns the bindings
to sony,imx415.yaml. Changes inspired by commit e2e73ed46c395 ("media:
dt-bindings: sony,imx415: Allow props from video-interface-devices")

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
12 months agoMerge tag 'tags/media-next-imx-20240419' of git://git.kernel.org/pub/scm/linux/kernel...
Hans Verkuil [Mon, 22 Apr 2024 08:44:31 +0000 (10:44 +0200)]
Merge tag 'tags/media-next-imx-20240419' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git into media_stage

NXP media drivers improvements.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.linuxtv.org/project/linux-media/patch/20240419103822.GA6868@pendragon.ideasonboard.com/
12 months agomedia: uvcvideo: Disable autosuspend for Insta360 Link
Ricardo Ribalda [Fri, 2 Dec 2022 16:48:52 +0000 (17:48 +0100)]
media: uvcvideo: Disable autosuspend for Insta360 Link

When the device suspends, it keeps power-cycling.

The user notices it because the LED constanct oscillate between
blue (ready) and no LED (off).

<6>[95202.128542] usb 3-3-port4: attempt power cycle
<6>[95206.070120] usb 3-3.4: new high-speed USB device number 49 using xhci_hcd
<6>[95206.212027] usb 3-3.4: New USB device found, idVendor=2e1a, idProduct=4c01, bcdDevice= 2.00
<6>[95206.212044] usb 3-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=<Serial: 1>
<6>[95206.212050] usb 3-3.4: Product: Insta360 Link
<6>[95206.212075] usb 3-3.4: Manufacturer: Amba
<7>[95206.214862] usb 3-3.4: GPIO lookup for consumer privacy
<7>[95206.214866] usb 3-3.4: using lookup tables for GPIO lookup
<7>[95206.214869] usb 3-3.4: No GPIO consumer privacy found
<6>[95206.214871] usb 3-3.4: Found UVC 1.10 device Insta360 Link (2e1a:4c01)
<3>[95206.217113] usb 3-3.4: Failed to query (GET_INFO) UVC control 14 on unit 1: -32 (exp. 1).
<3>[95206.217733] usb 3-3.4: Failed to query (GET_INFO) UVC control 16 on unit 1: -32 (exp. 1).
<4>[95206.223544] usb 3-3.4: Warning! Unlikely big volume range (=32767), cval->res is probably wrong.
<4>[95206.223554] usb 3-3.4: [9] FU [Mic Capture Volume] ch = 1, val = -32768/-1/1
<6>[95210.698990] usb 3-3.4: USB disconnect, device number 49
<6>[95211.963090] usb 3-3.4: new high-speed USB device number 50 using xhci_hcd
<6>[95212.657061] usb 3-3.4: new full-speed USB device number 51 using xhci_hcd
<3>[95212.783119] usb 3-3.4: device descriptor read/64, error -32
<3>[95213.015076] usb 3-3.4: device descriptor read/64, error -32
<6>[95213.120358] usb 3-3-port4: attempt power cycle

Bus 001 Device 009: ID 2e1a:4c01 Amba Insta360 Link
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x2e1a
  idProduct          0x4c01
  bcdDevice            2.00
  iManufacturer           1 Amba
  iProduct                2 Insta360 Link
  iSerial                 0
  bNumConfigurations      1

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20221101-instal-v1-0-d13d1331c4b5@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 months agomedia: uvcvideo: Fix power line control for Shine-Optics Camera
Ricardo Ribalda [Mon, 8 Jan 2024 14:04:16 +0000 (14:04 +0000)]
media: uvcvideo: Fix power line control for Shine-Optics Camera

The device does not implement the power line frequency control
correctly. It is a UVC 1.5 device, but implements the control as a UVC
1.1 device.

Add the corresponding control mapping override.

Bus 003 Device 002: ID 3277:009e Shine-Optics Integrated Camera
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x3277
  idProduct          0x009e
  bcdDevice            0.01
  iManufacturer           3 Shine-Optics
  iProduct                1 Integrated Camera
  iSerial                 2 0001

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240108-shine-v2-1-ddff959dab89@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 months agomedia: uvcvideo: Add quirk for Logitech Rally Bar
Ricardo Ribalda [Thu, 4 Apr 2024 18:00:49 +0000 (18:00 +0000)]
media: uvcvideo: Add quirk for Logitech Rally Bar

Logitech Rally Bar devices, despite behaving as UVC cameras, have a
different power management system that the other cameras from Logitech.

USB_QUIRK_RESET_RESUME is applied to all the UVC cameras from Logitech
at the usb core. Unfortunately, USB_QUIRK_RESET_RESUME causes undesired
USB disconnects in the Rally Bar that make them completely unusable.

There is an open discussion about if we should fix this in the core or
add a quirk in the UVC driver. In order to enable this hardware, let's
land this patch first, and we can revert it later if there is a
different conclusion.

Fixes: e387ef5c47dd ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams")
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Devinder Khroad <dkhroad@logitech.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20240404-rallybar-v6-1-6d67bb6b69af@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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]

12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>