linux.git
13 months agomedia: v4l2-subdev: Clearly document that the crop API won't be extended
Laurent Pinchart [Mon, 1 Apr 2024 23:37:25 +0000 (02:37 +0300)]
media: v4l2-subdev: Clearly document that the crop API won't be extended

The V4L2 subdev crop API has been marked as obsolete, deprecated by the
selection API. Despite this, it has recently been extended with streams
support. In hindsight this was a mistake. Make sure it doesn't happen
again by clearly documenting that no new extensions will be accepted.

Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.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>
13 months agomedia: si2165: Remove redundant NULL check before release_firmware() call
Minghao Chi [Mon, 6 Jun 2022 01:44:33 +0000 (02:44 +0100)]
media: si2165: Remove redundant NULL check before release_firmware() call

release_firmware() checks for NULL pointers internally so checking
before calling it is redundant.

Link: https://lore.kernel.org/linux-media/20220606014433.290667-1-chi.minghao@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Acked-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: flexcop-usb: fix sanity check of bNumEndpoints
Dongliang Mu [Thu, 2 Jun 2022 05:50:24 +0000 (06:50 +0100)]
media: flexcop-usb: fix sanity check of bNumEndpoints

Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type
") adds a sanity check for endpoint[1], but fails to modify the sanity
check of bNumEndpoints.

Fix this by modifying the sanity check of bNumEndpoints to 2.

Link: https://lore.kernel.org/linux-media/20220602055027.849014-1-dzm91@hust.edu.cn
Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: flexcop: allow for modern speeds
Oliver Neukum [Tue, 17 May 2022 13:11:09 +0000 (14:11 +0100)]
media: flexcop: allow for modern speeds

High speed is no longer the ultimate in speed.

Link: https://lore.kernel.org/linux-media/20220517131109.28371-2-oneukum@suse.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: flexcop: unneeded ATOMIC
Oliver Neukum [Tue, 17 May 2022 13:11:08 +0000 (14:11 +0100)]
media: flexcop: unneeded ATOMIC

No need for GFP_ATOMIC during probe()

Link: https://lore.kernel.org/linux-media/20220517131109.28371-1-oneukum@suse.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: as102: avoid GFP_ATOMIC
Oliver Neukum [Tue, 17 May 2022 11:10:49 +0000 (12:10 +0100)]
media: as102: avoid GFP_ATOMIC

No need for GFP_ATOMIC during probe()

Link: https://lore.kernel.org/linux-media/20220517111049.25611-1-oneukum@suse.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: imx214: Fix the error handling in imx214_probe()
Zheyu Ma [Tue, 10 May 2022 11:48:52 +0000 (12:48 +0100)]
media: imx214: Fix the error handling in imx214_probe()

The driver should disable regulators when fails to probe.

Link: https://lore.kernel.org/linux-media/20220510114852.1719018-1-zheyuma97@gmail.com
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: lgdt3306a: Add a check against null-pointer-def
Zheyu Ma [Tue, 5 Apr 2022 09:50:18 +0000 (10:50 +0100)]
media: lgdt3306a: Add a check against null-pointer-def

The driver should check whether the client provides the platform_data.

The following log reveals it:

[   29.610324] BUG: KASAN: null-ptr-deref in kmemdup+0x30/0x40
[   29.610730] Read of size 40 at addr 0000000000000000 by task bash/414
[   29.612820] Call Trace:
[   29.613030]  <TASK>
[   29.613201]  dump_stack_lvl+0x56/0x6f
[   29.613496]  ? kmemdup+0x30/0x40
[   29.613754]  print_report.cold+0x494/0x6b7
[   29.614082]  ? kmemdup+0x30/0x40
[   29.614340]  kasan_report+0x8a/0x190
[   29.614628]  ? kmemdup+0x30/0x40
[   29.614888]  kasan_check_range+0x14d/0x1d0
[   29.615213]  memcpy+0x20/0x60
[   29.615454]  kmemdup+0x30/0x40
[   29.615700]  lgdt3306a_probe+0x52/0x310
[   29.616339]  i2c_device_probe+0x951/0xa90

Link: https://lore.kernel.org/linux-media/20220405095018.3993578-1-zheyuma97@gmail.com
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: dw2102: fix coding style issues
Mauro Carvalho Chehab [Mon, 29 Apr 2024 08:27:51 +0000 (09:27 +0100)]
media: dw2102: fix coding style issues

Use checkpatch --strict --in-place to cleanup most style issues.
Then, do some manual work to fix most of the remaining issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: dw2102: Fix minor issues
Michael Bunk [Sun, 16 Jan 2022 11:22:38 +0000 (11:22 +0000)]
media: dw2102: Fix minor issues

Found by checkpatch.

Link: https://lore.kernel.org/linux-media/20220116112238.74171-4-micha@freedict.org
Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: dw2102: Dont't list TT Cinergy S2 R4 twice
Michael Bunk [Sun, 16 Jan 2022 11:22:37 +0000 (12:22 +0100)]
media: dw2102: Dont't list TT Cinergy S2 R4 twice

"modinfo dvb-usb-dw2102|grep 0105" returns two lines, because the module
reports this usb alias twice.

Remove one of them.

Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: dw2102: Don't translate i2c read into write
Michael Bunk [Sun, 16 Jan 2022 11:22:36 +0000 (11:22 +0000)]
media: dw2102: Don't translate i2c read into write

The code ignored the I2C_M_RD flag on I2C messages.  Instead it assumed
an i2c transaction with a single message must be a write operation and a
transaction with two messages would be a read operation.

Though this works for the driver code, it leads to problems once the i2c
device is exposed to code not knowing this convention.  For example,
I did "insmod i2c-dev" and issued read requests from userspace, which
were translated into write requests and destroyed the EEPROM of my
device.

So, just check and respect the I2C_M_READ flag, which indicates a read
when set on a message.  If it is absent, it is a write message.

Incidentally, changing from the case statement to a while loop allows
the code to lift the limitation to two i2c messages per transaction.

There are 4 more *_i2c_transfer functions affected by the same behaviour
and limitation that should be fixed in the same way.

Link: https://lore.kernel.org/linux-media/20220116112238.74171-2-micha@freedict.org
Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: m88ds3103: Fix lock led support
Michael Bunk [Sun, 16 Jan 2022 11:22:35 +0000 (11:22 +0000)]
media: m88ds3103: Fix lock led support

The new m88ds3101b demodulator version requires the highest bit of
register 0x11 be cleared after tuning to a new frequency to make the
lock output pin go high when a signal is found.  This pin is normally
connected to an indicator led.

Link: https://lore.kernel.org/linux-media/20220116112238.74171-1-micha@freedict.org
Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: i2c: max9271: Add header include guards to max9271.h
Laurent Pinchart [Sun, 2 Jan 2022 22:48:03 +0000 (22:48 +0000)]
media: i2c: max9271: Add header include guards to max9271.h

Protect against multiple inclusions of the max9271.h header with include
guards.

Link: https://lore.kernel.org/linux-media/20220102224803.27463-1-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
13 months agomedia: i2c: rdacm20: Fix indentation in comment
Laurent Pinchart [Sat, 1 Jan 2022 17:35:40 +0000 (17:35 +0000)]
media: i2c: rdacm20: Fix indentation in comment

Fix a small indentation issue in a comment block.

Link: https://lore.kernel.org/linux-media/20220101173540.9090-1-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: mediatek: vcodec: fix possible unbalanced PM counter
Eugen Hristev [Thu, 28 Dec 2023 11:32:40 +0000 (13:32 +0200)]
media: mediatek: vcodec: fix possible unbalanced PM counter

It is possible that mtk_vcodec_enc_pw_on fails, and in that scenario
the PM counter is not incremented, and subsequent call to
mtk_vcodec_enc_pw_off decrements the counter, leading to a PM imbalance.
Fix by bailing out of venc_if_encode in the case when mtk_vcodec_enc_pw_on
fails.

Fixes: 4e855a6efa54 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
14 months agomedia: mediatek: vcodec: Only free buffer VA that is not NULL
Fei Shao [Thu, 21 Dec 2023 09:17:46 +0000 (09:17 +0000)]
media: mediatek: vcodec: Only free buffer VA that is not NULL

In the MediaTek vcodec driver, while mtk_vcodec_mem_free() is mostly
called only when the buffer to free exists, there are some instances
that didn't do the check and triggered warnings in practice.

We believe those checks were forgotten unintentionally. Add the checks
back to fix the warnings.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: mediatek: vcodec: Update mtk_vcodec_mem_free() error messages
Fei Shao [Thu, 21 Dec 2023 09:17:45 +0000 (09:17 +0000)]
media: mediatek: vcodec: Update mtk_vcodec_mem_free() error messages

In mtk_vcodec_mem_free(), there are two cases where a NULL VA is passed:
- mem->size == 0: we are called to free no memory. This may happen when
  we call mtk_vcodec_mem_free() twice or the memory has never been
  allocated.
- mem->size > 0: we are called to free memory but without VA. This means
  that we failed to free the memory for real.

Both cases are not expected to happen, and we want to have clearer error
messages to describe which one we just encountered.
Update the error messages to include more information for that purpose.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: mediatek: vcodec: Drop unnecessary variable
Fei Shao [Thu, 21 Dec 2023 09:17:44 +0000 (09:17 +0000)]
media: mediatek: vcodec: Drop unnecessary variable

In mtk_vcodec_mem_alloc() and mtk_vcodec_mem_free(), the value of
mem->size is not expected to change before and when using the DMA APIs
and debug print, so there's no point in keeping local copies of it.

Drop the local variable "size" in the mentioned functions, and update
printk format identifiers accordingly.

This makes the code slightly more visually consistent, and retrieve a
small amount of memory that is used for no real purpose.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: mediatek: vcodec: Replace dev_name in error string
Fei Shao [Thu, 21 Dec 2023 09:17:43 +0000 (09:17 +0000)]
media: mediatek: vcodec: Replace dev_name in error string

mtk_v4l2_err() already uses dev_err(), so don't print the device name
again. Print the function name instead.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: v4l: async: Set owner for async sub-devices
Sakari Ailus [Wed, 13 Mar 2024 13:57:50 +0000 (13:57 +0000)]
media: v4l: async: Set owner for async sub-devices

Set the owner field of the async sub-devices by making
v4l2_async_register_subdev() a macro and obtaining THIS_MODULE that way.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: v4l: Set sub-device's owner field to the caller's module
Sakari Ailus [Wed, 13 Mar 2024 14:03:19 +0000 (14:03 +0000)]
media: v4l: Set sub-device's owner field to the caller's module

Set a sub-device's owner field to the caller's module, provided as an
argument to the function. v4l2_device_register_subdev() becomes a macro
passing THIS_MODULE to the __v4l2_device_register_subdev() function.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: imx219: Use dev_err_probe on probe
Umang Jain [Wed, 20 Mar 2024 07:00:27 +0000 (07:00 +0000)]
media: i2c: imx219: Use dev_err_probe on probe

Drop dev_err() and use the dev_err_probe() helper on probe path.

No functional changes intended.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Set timing registers programmatically
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:24 +0000 (23:45 +0100)]
media: i2c: ov4689: Set timing registers programmatically

Set timing-related and BLC anchor registers via cci calls instead of
hardcoding them in the register table. This prepares the driver for
implementation of configurable analogue crop and binning. No
functional change intended.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Move pixel array size out of struct ov4689_mode
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:23 +0000 (23:45 +0100)]
media: i2c: ov4689: Move pixel array size out of struct ov4689_mode

Pixel array dimensions and default crop size do not belong to the
ov4689_mode structure, since they are mode independent. Make them
defines instead.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Implement manual color balance controls
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:22 +0000 (23:45 +0100)]
media: i2c: ov4689: Implement manual color balance controls

The OV4689 sensor has separate red and blue gain settings (up to 4x).
Implement appropriate controls in the driver. Default gain values
are not modified.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Implement digital gain control
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:21 +0000 (23:45 +0100)]
media: i2c: ov4689: Implement digital gain control

The OV4689 sensor supports digital gain up to 16x. Implement
corresponding control in the driver. Default digital gain value is not
modified by this patch.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Implement vflip/hflip controls
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:20 +0000 (23:45 +0100)]
media: i2c: ov4689: Implement vflip/hflip controls

The OV4689 sensor supports horizontal and vertical flipping. Add
appropriate controls to the driver. Toggling both array flip and
digital flip bits allows to achieve flipping while maintaining output
Bayer order. Note that the default value of hflip control corresponds
to both bits set, as it was before this patch.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Make horizontal blanking configurable
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:19 +0000 (23:45 +0100)]
media: i2c: ov4689: Make horizontal blanking configurable

Make horizontal blanking configurable. To do so, set HTS register
according to the requested horizontal blanking in ov4689_set_ctrl
instead of the register table. Default HTS value is not changed by
this patch. Minimal HTS value is found experimentally and corresponds
to 90 fps framerate at minimum vertical blanking. Real HTS value is
the register value multiplied by 4.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Remove max_fps field from struct ov4689_mode
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:18 +0000 (23:45 +0100)]
media: i2c: ov4689: Remove max_fps field from struct ov4689_mode

max_fps field of struct ov4689_mode is unused in this driver, so
remove it.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Use runtime PM autosuspend
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:17 +0000 (23:45 +0100)]
media: i2c: ov4689: Use runtime PM autosuspend

Use runtime PM autosuspend to avoid powering off the sensor during
fast stop-reconfigure-restart cycles.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Enable runtime PM before registering sub-device
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:16 +0000 (23:45 +0100)]
media: i2c: ov4689: Enable runtime PM before registering sub-device

As the sensor may be accessible right after its async sub-device is
registered, enable runtime PM before doing so.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Use sub-device active state
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:15 +0000 (23:45 +0100)]
media: i2c: ov4689: Use sub-device active state

Use sub-device active state. Employ control handler lock to
synchronize access to the active state and s_stream.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Refactor ov4689_set_ctrl
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:14 +0000 (23:45 +0100)]
media: i2c: ov4689: Refactor ov4689_set_ctrl

Introduce local variable for regmap within the ov4689_set_ctrl
function. This adjustment eliminates repetition within the function.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Remove i2c_client from ov4689 struct
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:13 +0000 (23:45 +0100)]
media: i2c: ov4689: Remove i2c_client from ov4689 struct

The 'client' field within the 'ov4689' structure is solely used to
access its 'dev' member. This commit removes the 'client' field and
directly stores a pointer to the 'struct device'.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: CCI conversion
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:12 +0000 (23:45 +0100)]
media: i2c: ov4689: CCI conversion

Convert the i2c register accesses to utilize the CCI helper library
rather than relying on driver-specific functions. Also, set analogue
gain in a single 16-bit write instead of two 8-bit writes.

[Sakari Ailus: Initialise sensor_gain as 0.]

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Fix typo in a comment
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:11 +0000 (23:45 +0100)]
media: i2c: ov4689: Fix typo in a comment

Fix a spelling error in a comment.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Sort register definitions by address
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:10 +0000 (23:45 +0100)]
media: i2c: ov4689: Sort register definitions by address

Put register defininitions in the order of increasing register
address.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: i2c: ov4689: Clean up and annotate the register table
Mikhail Rudenko [Tue, 16 Apr 2024 22:45:09 +0000 (23:45 +0100)]
media: i2c: ov4689: Clean up and annotate the register table

Many values in the register table are actually power-on
defaults. Remove those and also unused HDR exposures and gains.
Annotate the remaining values using the publicly available datasheet
to facilitate further development. No functional change intended.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: atomisp: Fix sh_css_config_input_network_2400() coding style
Hans de Goede [Tue, 16 Apr 2024 09:19:52 +0000 (10:19 +0100)]
media: atomisp: Fix sh_css_config_input_network_2400() coding style

Fix the if (stream->config.mode == IA_CSS_INPUT_MODE_PRBS) {} block
coding style. Specifically fix the weird declaration of variables split
over multiple lines.

While at it also split the multi-line width calculation at a more
logical place.

Reported-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
14 months agomedia: atomisp: Remove setting of f->fmt.pix.priv from atomisp_set_fmt()
Hans de Goede [Sun, 14 Apr 2024 15:00:19 +0000 (16:00 +0100)]
media: atomisp: Remove setting of f->fmt.pix.priv from atomisp_set_fmt()

This value is not used by the driver, only returned to userspace and
userspace should not rely on / use the priv fields. Drop setting this.

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>
14 months agomedia: atomisp: Cleanup atomisp_isr_thread() spinlock handling
Hans de Goede [Sun, 14 Apr 2024 14:51:12 +0000 (15:51 +0100)]
media: atomisp: Cleanup atomisp_isr_thread() spinlock handling

Refactor the code a tiny bit to avoid the need to have 2 different
paths with spin_unlock_irqrestore() in there.

While at it also remove the non helpful dev_dbg() message.

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>
14 months agomedia: atomisp: Remove empty s_stream() op from CSI subdev
Hans de Goede [Sun, 14 Apr 2024 14:45:55 +0000 (15:45 +0100)]
media: atomisp: Remove empty s_stream() op from CSI subdev

Remove the empty csi2_set_stream() callback and remove the now
empty csi2_video_ops struct.

While at it also remove the empty csi2_core_ops struct.

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>
14 months agomedia: atomisp: Remove empty s_power() op from ISP subdev
Hans de Goede [Sun, 14 Apr 2024 14:41:38 +0000 (15:41 +0100)]
media: atomisp: Remove empty s_power() op from ISP subdev

Remove the empty isp_subdev_set_power() callback.

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>
14 months agomedia: atomisp: Remove clearing of ISP crop / compose rectangles on file release
Hans de Goede [Sun, 14 Apr 2024 14:40:09 +0000 (15:40 +0100)]
media: atomisp: Remove clearing of ISP crop / compose rectangles on file release

There is no need to clear the ISP sink-pad crop and source-pad
compose rectangles  on release of the /dev/video# file.

Both will be reset by atomisp_set_fmt() which is guaranteed to
get called by atomisp_queue_setup() (if not called already)
before another stream starts and thus before these selections
are used again.

Also the file injection support the comment talks about has long
been dropped from the driver.

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>
14 months agomedia: atomisp: Remove struct atomisp_platform_data
Hans de Goede [Sun, 14 Apr 2024 14:31:26 +0000 (15:31 +0100)]
media: atomisp: Remove struct atomisp_platform_data

struct atomisp_platform_data only has a single subdevs member. Remove
this struct and replace atomisp_get_platform_data() with
atomisp_platform_get_subdevs().

Note atomisp_get_platform_data() and now atomisp_platform_get_subdevs()
always succeed, so while at it also remove unnecessary error checking.

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>
14 months agomedia: atomisp: Remove gmin_platform VCM code.
Hans de Goede [Sun, 14 Apr 2024 13:57:43 +0000 (14:57 +0100)]
media: atomisp: Remove gmin_platform VCM code.

VCM support has already been removed from the main atomisp driver
in commit 7473c97dd8d0 ("media: atomisp: Remove custom VCM handling")
remove the left-over dead VCM handling from the gmin platform code.

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>
14 months agomedia: atomisp: Drop intel_v4l2_subdev_type
Hans de Goede [Sun, 14 Apr 2024 14:25:38 +0000 (15:25 +0100)]
media: atomisp: Drop intel_v4l2_subdev_type

intel_v4l2_subdev_type / atomisp_input_subdev.type now always is
RAW_CAMERA, drop it.

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>
14 months agomedia: atomisp: Drop unused frame_status tracking
Hans de Goede [Sat, 13 Apr 2024 15:14:52 +0000 (16:14 +0100)]
media: atomisp: Drop unused frame_status tracking

After removing the flash support frame_status now always is
ATOMISP_FRAME_STATUS_OK aka 0. Drop frame_status tracking.

This also means one less atomisp custom use for the vb2_buffer->reserved*
fields (all custom use of these fields should be removed).

While at it also remove the no longer used vf_frame pointer from
struct atomisp_sub_device.

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>
14 months agomedia: atomisp: Drop custom flash support
Hans de Goede [Sat, 13 Apr 2024 15:10:41 +0000 (16:10 +0100)]
media: atomisp: Drop custom flash support

Remove the custom flash handling from the atomisp driver. There are
only few Bay Trail / Cherry Trail devices with flash and if those will
ever get supported then this should be done through the new standard
include/linux/led-class-flash.h APIs instead of with atomisp specific
custom APIs.

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>
14 months agomedia: atomisp: Drop the atomisp custom lm3554 flash driver
Hans de Goede [Sat, 13 Apr 2024 14:26:18 +0000 (15:26 +0100)]
media: atomisp: Drop the atomisp custom lm3554 flash driver

Drop the atomisp custom lm3554 flash driver, support for flash drivers
using the custom atomisp flash interface is going to be removed from
the atomisp driver.

If flash supports for the lm3554 turns out to be necessary on some
atomisp devices in the future then this should be re-implemented
using the new include/linux/led-class-flash.h APIs.

The atomisp specific lm3554 driver could still be usable as a reference
for how to use / driver the lm3554 for a future re-implementation
using standardized APIs, but for that it can be retrieved from
the git history.

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>
14 months agomedia: atomisp: Remove input_port_ID_t
Hans de Goede [Fri, 12 Apr 2024 18:38:55 +0000 (19:38 +0100)]
media: atomisp: Remove input_port_ID_t

Change the single, unexpected user of CSI_PORT0_ID

for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++)

to

for (port = 0; port < N_CSI_PORTS; port++) {

matching all the other for-loops iterating over the ports in
the same file.

And remove the now fully unused input_port_ID_t enum type.

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>
14 months agomedia: atomisp: Remove test pattern generator (TPG) support
Hans de Goede [Fri, 12 Apr 2024 18:28:46 +0000 (19:28 +0100)]
media: atomisp: Remove test pattern generator (TPG) support

The TPG support registers a v4l2-subdev for this, but this is not part of
the media-controller graph in any way. After manually selecting the TPG
as input using the s_input ioctl it does not work.

Several supported sensors have their own working TPG and using the sensor's
TPG means that the same data-flow is used as with actual sensors rather
then the quite different data-flow from the ISP's builtin TPG.

Remove the broken TPG support, when a test-pattern is needed for testing
a sensor's TPG can be used. Using a sensor's TPG is actually better for
testing since then the actual normal data-flow is being tested.

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>
14 months agomedia: atomisp: ov2722: Remove power on sensor from set_fmt() callback
Hans de Goede [Fri, 12 Apr 2024 14:38:14 +0000 (15:38 +0100)]
media: atomisp: ov2722: Remove power on sensor from set_fmt() callback

The atomisp driver now properly ensures s_power(1) is called before calling
the set_fmt() callback, so this workaround is no longer necessary.

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>
14 months agomedia: atomisp: Drop atomisp_pipe_check() from atomisp_link_setup()
Hans de Goede [Wed, 10 Apr 2024 16:15:32 +0000 (17:15 +0100)]
media: atomisp: Drop atomisp_pipe_check() from atomisp_link_setup()

The media-controller core (__media_entity_setup_link()) already checks
that the pads of the link are not streaming before calling the setup_link()
pad-op so calling atomisp_pipe_check() is not necessary;

and taking isp->mutex inside the setup_link() pad-op leads to a possible
ABBA deadlock vs the media-device graph_mutex which in the case of
the setup_link() pad-op is taken before calling the op, while in other
scenarios the graph_mutex is taken after the isp->mutex.

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>
14 months agomedia: atomisp: Call media_pipeline_alloc_start() in stream start
Hans de Goede [Fri, 12 Apr 2024 12:39:50 +0000 (13:39 +0100)]
media: atomisp: Call media_pipeline_alloc_start() in stream start

Call media_pipeline_alloc_start() from atomisp_start_streaming() to mark
all involved subdevs as busy so that the links cannot be changed through
the media-controller APIs while streaming.

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>
14 months agomedia: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad
Hans de Goede [Fri, 12 Apr 2024 14:27:53 +0000 (15:27 +0100)]
media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad

Most sensor drivers report V4L2_FIELD_NONE as v4l2_mbus_framefmt.field
value. Propagate this to the v4l2_mbus_framefmt for the CSI port to pass
the link validation done by media_pipeline_start().

Keep the v4l2_mbus_framefmt.field for the source pad of the CSI port
as V4L2_FIELD_ANY to match the ISP sink pad.

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>
14 months agomedia: atomisp: Propagate set_fmt on sensor results to CSI port
Hans de Goede [Fri, 12 Apr 2024 13:51:15 +0000 (14:51 +0100)]
media: atomisp: Propagate set_fmt on sensor results to CSI port

So far the CSI port sink and source pads have not had their fmt set at all,
leaving things at the default of SBGGR8_1X8/0x0.

This means that pipeline validation such as e.g. done when calling
media_pipeline_start() will fail since the links to / from the CSI
ports have different fmts on each end.

Store a pointer to the CSI port v4l2-subdev in struct atomisp_input_subdev,
and use this in atomisp_set_sensor_crop_and_fmt() to propagate the sensors
new fmt after a successful set_fmt to the CSI port it is connected too.

The input->csi_port pointer also allows simplifying atomisp_link_setup().

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>
14 months agomedia: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor
Hans de Goede [Thu, 11 Apr 2024 20:21:37 +0000 (21:21 +0100)]
media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor

Add a new atomisp_setup_input_links() helper which ensures that
the CSI-receiver -> ISP link for input_curr is marked as enabled and
the other CSI-receiver -> ISP links are disabled.

And call this helper from atomisp_register_device_nodes() for the initial
setup and from atomisp_select_input() for runtime input_curr changes.

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>
14 months agomedia: atomisp: Simplify atomisp_s_input() input argument checking
Hans de Goede [Thu, 11 Apr 2024 17:47:41 +0000 (18:47 +0100)]
media: atomisp: Simplify atomisp_s_input() input argument checking

Simplify the checking of the input argument to atomisp_s_input():
- Remove the check for input >= ATOM_ISP_MAX_INPUTS, input_cnt
  never is > ATOM_ISP_MAX_INPUTS so checking only that is sufficient
- Remove the unnecessary camera local variable
- Move the 2 invalid argument checks to above the atomisp_pipe_check()
  which checks if the pipe is busy or not

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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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
14 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./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/
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>