platform/kernel/linux-starfive.git
22 months agomedia: venus: venc: Set HDR10 PQ SEI property only for MAIN10 profile
Stanimir Varbanov [Fri, 2 Sep 2022 10:01:58 +0000 (12:01 +0200)]
media: venus: venc: Set HDR10 PQ SEI property only for MAIN10 profile

The HDR10 PQ SEI should be set only when the codec is HEVC and
the profile is MAIN10, otherwise some artefacts could be produced
on the encoded bitstream.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus: venc_ctrls: Add default value for CLL info
Stanimir Varbanov [Fri, 2 Sep 2022 10:00:31 +0000 (12:00 +0200)]
media: venus: venc_ctrls: Add default value for CLL info

Add default value for CLL info when creating compound control.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Allow MIN/MAX settings for the v4l2 encoder controls defined range.
Vikash Garodia [Mon, 8 Aug 2022 09:28:34 +0000 (11:28 +0200)]
media: venus : Allow MIN/MAX settings for the v4l2 encoder controls defined range.

Control MIN/MAX range defined as 0 to 1, as MIN value setting enabled
for V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM.

error details: fail: v4l2-test-controls.cpp(516):
invalid maximum range check

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Vikash Garodia <vgarodia@qti.qualcomm.com>
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Remove the capture plane settings for venc_g_parm/venc_s_parm
Viswanath Boma [Mon, 8 Aug 2022 09:28:33 +0000 (11:28 +0200)]
media: venus : Remove the capture plane settings for venc_g_parm/venc_s_parm

v4l2 compliance expecting settings for out buffer only and the same
values will be propagated to capture buffer setting by h/w encoder .
settings on cpature plane are optional , required only if
offline-encoding supports.

error details : fail: v4l2-test-formats.cpp(1350): !ret

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Addition of support for VIDIOC_TRY_ENCODER_CMD
Dikshita Agarwal [Mon, 8 Aug 2022 09:28:32 +0000 (11:28 +0200)]
media: venus : Addition of support for VIDIOC_TRY_ENCODER_CMD

v4l2 compliance expecting support for vidioc_try_encoder_cmd .

error details : test VIDIOC_(TRY_)ENCODER_CMD: FAIL

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Addition of EOS Event support for Encoder
Viswanath Boma [Mon, 8 Aug 2022 09:28:31 +0000 (11:28 +0200)]
media: venus : Addition of EOS Event support for Encoder

V4l2 encoder compliance expecting End of stream Event registration
support for Encoder.

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Vikash Garodia <vgarodia@qti.qualcomm.com>
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : CAPTURE Plane width/height alignment with OUT plane.
Stanimir Varbanov [Mon, 8 Aug 2022 09:28:30 +0000 (11:28 +0200)]
media: venus : CAPTURE Plane width/height alignment with OUT plane.

V4l2 encoder compliance set-format test cases failing as Capture plane
width/height not aligned to OUT plane .

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Addition of control support - V4L2_CID_MIN_BUFFERS_FOR_OUTPUT
Viswanath Boma [Mon, 8 Aug 2022 09:28:29 +0000 (11:28 +0200)]
media: venus : Addition of control support - V4L2_CID_MIN_BUFFERS_FOR_OUTPUT

V4l2 encoder compliance expecting minimum buffers support for
the application to allocate buffers as per the control support values.

Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus : Add default values for the control
Stanimir Varbanov [Mon, 8 Aug 2022 09:28:28 +0000 (11:28 +0200)]
media: venus : Add default values for the control

V4l2 encoder compliance expecting default values of colorimetry
for the control.

Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX
Bryan O'Donoghue [Tue, 26 Jul 2022 02:14:55 +0000 (04:14 +0200)]
media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX

HFI_VERSION_1XX uses HFI_BUFFER_OUTPUT not HFI_BUFFER_OUTPUT2 for decoder
buffers.

venus_helper_check_format() places a constraint on an output buffer to be
of type HFI_BUFFER_OUTPUT2. HFI_1XX uses HFI_BUFFER_OUTPUT though.

Switching to the logic used in venus_helper_get_out_fmts() first checking
for HFI_BUFFER_OUTPUT and then HFI_BUFFER_OUTPUT2 resolves on HFI_1XX.

db410c before:
root@linaro-alip:~# v4l2-ctl  -d /dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture Multiplanar

        [0]: 'MPG4' (MPEG-4 Part 2 ES, compressed)
        [1]: 'H263' (H.263, compressed)
        [2]: 'H264' (H.264, compressed)
        [3]: 'VP80' (VP8, compressed)

root@linaro-alip:~# v4l2-ctl  -d /dev/video1 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture Multiplanar

db410c after:
root@linaro-alip:~# v4l2-ctl  -d /dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture Multiplanar

        [0]: 'MPG4' (MPEG-4 Part 2 ES, compressed)
        [1]: 'H263' (H.263, compressed)
        [2]: 'H264' (H.264, compressed)
        [3]: 'VP80' (VP8, compressed)

root@linaro-alip:~# v4l2-ctl  -d /dev/video1 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture Multiplanar

        [0]: 'NV12' (Y/CbCr 4:2:0)

Validated playback with ffplay on db410c with h264 and vp8 decoding.

Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format")
Cc: stable@vger.kernel.org # v5.19
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: venus: dec: Handle the case where find_format fails
Bryan O'Donoghue [Tue, 26 Jul 2022 02:14:54 +0000 (04:14 +0200)]
media: venus: dec: Handle the case where find_format fails

Debugging the decoder on msm8916 I noticed the vdec probe was crashing if
the fmt pointer was NULL.

A similar fix from Colin Ian King found by Coverity was implemented for the
encoder. Implement the same fix on the decoder.

Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")
Cc: stable@vger.kernel.org # v4.13+
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: cx88: add IR remote support for NotOnlyTV LV3H
Daniel González Cabanelas [Mon, 7 Feb 2022 14:51:41 +0000 (15:51 +0100)]
media: cx88: add IR remote support for NotOnlyTV LV3H

The PCI hybrid card NotOnlyTV LV3H has a built-in IR receiver connected
via I2C bus, currently not supported. This receiver is probably present
in more Geniatech cards. It has no capability for repeating when a key is
held down.

Add support for this built-in IR receiver. Use the existing Total Media
In Hand_02 remote keytable (Geniatech Mygica X8507) which matches exactly
the LV3H remote.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
Signed-off-by: Marek Kidawski <mark_kiddy@wp.pl>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: sunxi: Fix some error handling path of sun6i_mipi_csi2_probe()
Christophe JAILLET [Tue, 23 Aug 2022 07:42:11 +0000 (09:42 +0200)]
media: sunxi: Fix some error handling path of sun6i_mipi_csi2_probe()

Release some resources in the error handling path of the probe and of
sun6i_mipi_csi2_resources_setup(), as already done in the remove
function.

Fixes: af54b4f4c17f ("media: sunxi: Add support for the A31 MIPI CSI-2 controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe()
Christophe JAILLET [Tue, 23 Aug 2022 07:42:01 +0000 (09:42 +0200)]
media: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe()

Release some resources in the error handling path of the probe and of
sun8i_a83t_mipi_csi2_resources_setup(), as already done in the remove
function.

Fixes: 576d196c522b ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: don't store an unused sink data on a var
Mauro Carvalho Chehab [Sat, 24 Sep 2022 09:10:22 +0000 (11:10 +0200)]
media: atomisp: don't store an unused sink data on a var

Fixes this Werror breakage:

drivers/staging/media/atomisp/pci/atomisp_ioctl.c: In function 'atomisp_streamon':
drivers/staging/media/atomisp/pci/atomisp_ioctl.c:1714:44: error: variable 'sink' set but not used [-Werror=unused-but-set-variable]
 1714 |                 struct v4l2_mbus_framefmt *sink;
      |                                            ^~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp_gmin_platform: Unexport and split camera_sensor_csi()
Andy Shevchenko [Sat, 30 Jul 2022 16:20:27 +0000 (18:20 +0200)]
media: atomisp_gmin_platform: Unexport and split camera_sensor_csi()

The camera_sensor_csi() is not used outside the module, hence make it
static. While at it, split it to _alloc() and _free() to clearly show
the idea behind the last parameter @flag that is passed to
gmin_csi_cfg().

Link: https://lore.kernel.org/r/20220730162027.1011-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove atomisp_source_pad_to_stream_id()
Hans de Goede [Fri, 9 Sep 2022 21:46:39 +0000 (23:46 +0200)]
media: atomisp: Remove atomisp_source_pad_to_stream_id()

atomisp_source_pad_to_stream_id() returns ATOMISP_INPUT_STREAM_GENERAL
unconditionally now. Drop it and directly use ATOMISP_INPUT_STREAM_GENERAL
in its callers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove const/fixed camera_caps
Hans de Goede [Sun, 4 Sep 2022 16:54:36 +0000 (18:54 +0200)]
media: atomisp: Remove const/fixed camera_caps

The code checks a camera_caps struct in various places, but this always
points to the same const camera_caps struct.

Remove the checks, keeping the code paths which would be taken with
the fixed camera caps struct still in place and remove the camera_caps
struct itself.

Note this completely removes atomisp_pause_buffer_event() because that
only ever does something if camera_caps.sensors[0].is_slave is true and
that never is true.

Reviewed-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>
22 months agomedia: atomisp: Remove unused atomisp_css_get_dis_statistics()
Hans de Goede [Sun, 4 Sep 2022 13:04:36 +0000 (15:04 +0200)]
media: atomisp: Remove unused atomisp_css_get_dis_statistics()

Remove the unused atomisp_css_get_dis_statistics() function. This seems to
be a leftover variant / older version of atomisp_css_get_dis_stats() which
is actually used.

Reviewed-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>
22 months agomedia: atomisp: Make atomisp_set_raw_buffer_bitmap() static
Hans de Goede [Sun, 4 Sep 2022 12:59:08 +0000 (14:59 +0200)]
media: atomisp: Make atomisp_set_raw_buffer_bitmap() static

atomisp_set_raw_buffer_bitmap() is only used in atomisp_cmd.c,
make it static. Unfortunately this still requires a forward
declaration (the function cannot be moved easily).

Still this will at least make it obvious to anyone reading the code
that the function is not used elsewhere.

Reviewed-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>
22 months agomedia: atomisp: Drop unnecessary first_streamoff check
Hans de Goede [Sun, 4 Sep 2022 08:56:47 +0000 (10:56 +0200)]
media: atomisp: Drop unnecessary first_streamoff check

Drop an unnecessary first_streamoff check from atomisp_streamoff(),
above the check there is a:

if (!first_streamoff)
goto stop_sensor;

Code block which will jump over the code with the test, so the test
is only executed when first_streamoff is true and therefor the test
is not necessary.

Reviewed-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>
22 months agomedia: atomisp: Remove a couple of not useful function wrappers
Hans de Goede [Sun, 4 Sep 2022 08:47:23 +0000 (10:47 +0200)]
media: atomisp: Remove a couple of not useful function wrappers

The __atomisp_reqbufs(), __atomisp_streamoff() are 1:1 wrappers for
the non __ prefixed functions now, drop these wrappers.

The atomisp_s_fmt_cap() wrapper is almost a 1:1 wrapper for
atomisp_set_fmt() adjust the latter to have the right function
prototype and drop the wrapper.

Reviewed-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>
22 months agomedia: atomisp: Use video_dev.lock for ioctl locking
Hans de Goede [Fri, 2 Sep 2022 21:56:48 +0000 (23:56 +0200)]
media: atomisp: Use video_dev.lock for ioctl locking

Set video_dev.lock to point to isp->mutex so that the core does
the locking surroundig ioctls for us and drop all the now no longer
necessary (and conflicting) locking from the ioctl handling code.

Reviewed-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>
22 months agomedia: atomisp: Drop streamoff_mutex
Hans de Goede [Sat, 3 Sep 2022 21:42:53 +0000 (23:42 +0200)]
media: atomisp: Drop streamoff_mutex

Now that __atomisp_streamoff() no longer drops isp->mutex to cancel
the watchdog timer, the streamoff_mutex is no longer necessary to
avoid multiple streamoffs racing with each other.

Reviewed-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>
22 months agomedia: atomisp: Rework asd->streaming state update in __atomisp_streamoff()
Hans de Goede [Sat, 3 Sep 2022 21:50:42 +0000 (23:50 +0200)]
media: atomisp: Rework asd->streaming state update in __atomisp_streamoff()

During the first __atomisp_streamoff() call on an asd with only one pipe
streaming asd->streaming would get set twice:

asd->streaming = ATOMISP_DEVICE_STREAMING_STOPPING;
asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;

Rework the code a bit so that it gets set to the correct value
right away instead of doing this in 2 steps.

Reviewed-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>
22 months agomedia: atomisp: Move atomisp_streaming_count() check into __atomisp_css_recover()
Hans de Goede [Sat, 3 Sep 2022 21:36:01 +0000 (23:36 +0200)]
media: atomisp: Move atomisp_streaming_count() check into __atomisp_css_recover()

Both callers of __atomisp_css_recover() check atomisp_streaming_count()
first, move the check into __atomisp_css_recover().

And __atomisp_css_recover() already calls lockdep_assert_held(&isp->mutex),
so drop that from atomisp_css_flush().

Reviewed-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>
22 months agomedia: atomisp: Remove watchdog timer
Hans de Goede [Sat, 3 Sep 2022 21:26:27 +0000 (23:26 +0200)]
media: atomisp: Remove watchdog timer

The watchdog timer code to recover from the ISP getting stuck has several
major issues:

1. There is no way to do fault injection and normally the ISP does not
get stuck, so is it is impossible to test it.

2. It in essence just stops all streams, resets the ISP and then brings
everything back up. Userspace can easily do this itself by using a
timeout on dqbuf and then closing (which causes a poweroff) +
re-opening the device. Doing this in userspace (if it ever turns out
to be necessary) greatly simplifies the kernel code and in general
will be a more robust solution.

Even just a quick look at the code finds several more issues:

3. The need to sync-cancel the timers + work on streamoff requires
isp->mutex to be dropped halfway during the ioctl opening all sorts of
races.

4. The atomisp code supports setting up 2 pipelines, streaming from
two sensors at the same time. But there is only a single wdt_work
and stopping one of the 2 streams will cancel the timers + work,
stopping the wdt even though the other stream might still be running.

5. In case atomisp_css_flush() the sync cancel is done while keeping
isp->mutex locked, causing a deadlock when racing with wdt_work which
also takes isp->mutex.

6. Even though the watchdog is purely a software/driver thing which
just checkes that new frames keep coming in, there are 2 completely
different implementations for the ISP2400/ISP2401 which is not
necessary at all.

So all in all I believe that it is better to just remove the current
watchdog implementation. Fixing all the issues with the current
implementation will be so much work, that if it turns out that we do
need something like this then doing a clean re-implementation from
scratch will be better anyways.

wdt_work was also (ab)used to reset the ISP after the firmware signalled
an fw-assert error through the irq, add a new assert_recover_work to
replace this.

Reviewed-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>
22 months agomedia: atomisp: Add atomisp_pipe_check() helper
Hans de Goede [Sat, 3 Sep 2022 12:49:39 +0000 (14:49 +0200)]
media: atomisp: Add atomisp_pipe_check() helper

Several of the ioctl handlers all do the same checks
(isp->fatal_error and asd->streaming errors) add
an atomisp_pipe_check() helper for this.

Note this changes the vidioc_s_fmt_vid_cap and vidioc_s_input handlers
to now reject calls made while asd->streaming==STOPPING. This fixes
a possible race where one thread can make this ioctls while
vidioc_streamoff is running from another thread and it has
temporarily released isp->mutex to kill the watchdog timers / work.

Reviewed-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>
22 months agomedia: atomisp: Remove asd == NULL checks from ioctl handling
Hans de Goede [Sat, 3 Sep 2022 10:41:15 +0000 (12:41 +0200)]
media: atomisp: Remove asd == NULL checks from ioctl handling

At probe time isp_subdev_init_entities() sets pipe->asd to a non NULL
value for all four (preview/vf/capture/capture_video) pipes by calling
atomisp_init_subdev_pipe() for all 4 pipes.

So it can never be NULL. Remove the redundant NULL checks.

Reviewed-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>
22 months agomedia: atomisp: Fix locking around asd->streaming read/write
Hans de Goede [Fri, 2 Sep 2022 11:39:51 +0000 (13:39 +0200)]
media: atomisp: Fix locking around asd->streaming read/write

For reading / writing the asd->streaming enum the following rules
should be followed:

1. Writers of streaming must hold both isp->mutex and isp->lock.
2. Readers of streaming need to hold only one of the two locks.

Not all writers where properly taking both locks this fixes this.

In the case of the readers, many readers depend on their caller
to hold isp->mutex, add asserts for this

And in the case of atomisp_css_get_dis_stat() it is called with
isp->mutex held, so there is no need to take the spinlock just
for reading the streaming value.

Reviewed-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>
22 months agomedia: atomisp: Remove unused lock member from struct atomisp_sub_device
Hans de Goede [Fri, 2 Sep 2022 11:04:33 +0000 (13:04 +0200)]
media: atomisp: Remove unused lock member from struct atomisp_sub_device

The spin-lock embedded in struct atomisp_sub_device is not used anywhere,
remove it.

Reviewed-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>
22 months agomedia: atomisp: Use a normal mutex for the main lock
Hans de Goede [Fri, 2 Sep 2022 10:26:51 +0000 (12:26 +0200)]
media: atomisp: Use a normal mutex for the main lock

There is no reason for atomisp to use a rt_mutex instead of a normal
mutex, so switch over to a normal mutex.

All the changes in this patch are just s/rt_mutex/mutex/.

This is a preparation patch for switching the ioctl locking over
to using the video_dev.lock member so that the v4l2-core takes
care of the locking.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: prevent integer overflow in sh_css_set_black_frame()
Dan Carpenter [Thu, 1 Sep 2022 05:20:09 +0000 (07:20 +0200)]
media: atomisp: prevent integer overflow in sh_css_set_black_frame()

The "height" and "width" values come from the user so the "height * width"
multiplication can overflow.

Link: https://lore.kernel.org/r/YxBBCRnm3mmvaiuR@kili
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Simplify v4l2_fh_open() error handling
Hans de Goede [Mon, 29 Aug 2022 10:37:11 +0000 (12:37 +0200)]
media: atomisp: Simplify v4l2_fh_open() error handling

v4l2_fh_open() can only fail with -ENOMEM and as a generic rule drivers
do not log their own errors for -ENOMEM since the kernel will already
have complained loudly about this before the -ENOMEM return.

Remove the unnecessary error logging from atomisp_open().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Fix v4l2_fh resource leak on open errors
Hans de Goede [Mon, 29 Aug 2022 10:35:43 +0000 (12:35 +0200)]
media: atomisp: Fix v4l2_fh resource leak on open errors

When atomisp_open() fails then it must call v4l2_fh_release() to undo
the results of v4l2_fh_open().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove loading mutex
Hans de Goede [Mon, 29 Aug 2022 10:30:08 +0000 (12:30 +0200)]
media: atomisp: Remove loading mutex

Now that the registering of the /dev/* video / subdev nodes has been
moved to the end of atomisp_pci_probe() the workaround with the loading
mutex to delay opens until init is done is no longer necessary.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()
Hans de Goede [Sun, 28 Aug 2022 22:12:12 +0000 (00:12 +0200)]
media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()

Register /dev/* nodes at the end of atomisp_pci_probe(), this is
a prerequisite for dropping the loading mutex + ready flag kludge
for delaying open() calls on the /dev/* nodes .

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Split subdev and video-node registration into 2 steps
Hans de Goede [Sun, 28 Aug 2022 19:41:50 +0000 (21:41 +0200)]
media: atomisp: Split subdev and video-node registration into 2 steps

Split subdev and video-node registration into 2 steps, this is
a preparation step for moving video-node registration to the
end of probe() so that the loading() mutex can be removed.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove empty atomisp_css_set_cont_prev_start_time() function
Hans de Goede [Sun, 28 Aug 2022 19:15:52 +0000 (21:15 +0200)]
media: atomisp: Remove empty atomisp_css_set_cont_prev_start_time() function

atomisp_css_set_cont_prev_start_time() is a no-op, remove it.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove some further ATOMISP_ACC_* related dead code
Hans de Goede [Sun, 28 Aug 2022 19:11:51 +0000 (21:11 +0200)]
media: atomisp: Remove some further ATOMISP_ACC_* related dead code

Remove some more code which is no longer referenced after the removal
of the ATOMISP_ACC_* custom ioctls.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove the ACC device node
Hans de Goede [Sun, 28 Aug 2022 19:00:20 +0000 (21:00 +0200)]
media: atomisp: Remove the ACC device node

The ACC /dev/video# device node uses a struct video_device embedded in
an atomisp_acc_pipe struct instead of in an atomisp_video_pipe struct.
Yet it uses the same file-ops and ioctl-ops even though it does not have
a videobuf queue, which makes e.g. the mmap fop nonsense.

Worse the only file-ops / ioctls which differentiate between
the 2 types and correctly do container_of on the right type
are the open/release fops and the vidioc_default handler.

The mmap and poll fops and *all* other ioctl handlers unconditionally
do container_of on the passed in struct video_device blindly assuming
they are dealing with the one embedded in the atomisp_video_pipe struct.

This makes it trivial for userspace to cause all sort of undefined behavior
by calling mmap, poll or the other ioctls on the ACC device node!

Presumably the use of the ACC device node was to allow making the special
ioctls to load custom programs while the other /dev/video# nodes were
already open, since the /dev/video# nodes can currently all be opened
only once (which needs to be fixed).

commit 4bbca788b6eb ("media: atomisp: remove private acceleration ioctls")
has removed the custom ATOMISP_ACC_* ioctls, so there no longer is any
reason to keep the ACC device node.

As explained above its presence can easily cause the kernel to crash,
so remove the ACC device node and the code for handling it.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove never set file_input flag
Hans de Goede [Sat, 27 Aug 2022 14:49:23 +0000 (16:49 +0200)]
media: atomisp: Remove never set file_input flag

After the file-injection support removal the file_input flag is
always false.

Remove the flag and replace any code checking it with the code-path
for when it is false.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove the outq videobuf queue
Hans de Goede [Sat, 27 Aug 2022 14:39:10 +0000 (16:39 +0200)]
media: atomisp: Remove the outq videobuf queue

After the file-injection support removal the outq videobuf queue is
no longer used, remove it.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove atomisp_file_fops and atomisp_file_ioctl_ops
Hans de Goede [Sat, 27 Aug 2022 14:28:50 +0000 (16:28 +0200)]
media: atomisp: Remove atomisp_file_fops and atomisp_file_ioctl_ops

After the file-injection support removal, atomisp_video_pipe->type never
is V4L2_BUF_TYPE_VIDEO_OUTPUT anymore, so the V4L2_BUF_TYPE_VIDEO_OUTPUT
support path in atomisp_video_init() is never hit and this path is
the only user of atomisp_file_fops and atomisp_file_ioctl_ops.

Remove atomisp_file_fops and atomisp_file_ioctl_ops and all of
the functions which are only referenced by these ops structs.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Remove file-injection support
Hans de Goede [Sat, 27 Aug 2022 14:17:07 +0000 (16:17 +0200)]
media: atomisp: Remove file-injection support

The file-injection support of the atomisp driver has not been tested
and is not necessary for camera support, remove it.

Note the main reason for removing this is because it depends on
the videobuf (version 1) outq and we want to remove or replace
all videobuf usage in the driver.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Fix device_caps reporting of the registered video-devs
Hans de Goede [Sat, 27 Aug 2022 13:54:27 +0000 (15:54 +0200)]
media: atomisp: Fix device_caps reporting of the registered video-devs

atomisp_subdev_register_entities() had V4L2_CAP_VIDEO_CAPTURE /
V4L2_CAP_VIDEO_OUT swapped. Or-ing in V4L2_CAP_VIDEO_OUT for
the nodes which allow capturing from the camera and or-ing in
V4L2_CAP_VIDEO_CAPTURE for the file-injection node
(mem2mem use of the ISP).

Things happen to still work for the capture device-nodes because
the "shared" caps also included V4L2_CAP_VIDEO_CAPTURE, so those
shared nodes advertised V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUT.

Fix things so that only the correct caps are advertised.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: atomisp: Ensure that USERPTR pointers are page aligned
Hans de Goede [Sun, 21 Aug 2022 18:29:06 +0000 (20:29 +0200)]
media: atomisp: Ensure that USERPTR pointers are page aligned

The atomisp code needs USERPTR pointers to be page aligned,
otherwise bad things (scribbling over other parts of the
process' RAM) happen.

Add a check to ensure this and exit VIDIOC_QBUF calls with
unaligned pointers with -EINVAL.

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>
22 months agomedia: atomisp: hmm_bo: Drop PFN code path from alloc_user_pages()
Hans de Goede [Sun, 21 Aug 2022 18:43:57 +0000 (20:43 +0200)]
media: atomisp: hmm_bo: Drop PFN code path from alloc_user_pages()

alloc_user_pages() is only ever called on qbuf for USERPTR buffers which
always hits the get_user_pages_fast() path, so the pin_user_pages() path
can be removed.

Getting the vma then also is no longer necessary since that is only
done to determine which path to use.

And this also removes the only users of the mem_type struct hmm_bo member,
so remove that as well.

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>
22 months agomedia: atomisp: hmm_bo: Rewrite free_private_pages() using pages_array helper funcs
Hans de Goede [Sat, 13 Aug 2022 16:06:10 +0000 (18:06 +0200)]
media: atomisp: hmm_bo: Rewrite free_private_pages() using pages_array helper funcs

Rewrite free_private_pages() using pages_array helper funcs.

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>
22 months agomedia: atomisp: hmm_bo: Rewrite alloc_private_pages() using pages_array helper funcs
Hans de Goede [Sat, 13 Aug 2022 16:00:38 +0000 (18:00 +0200)]
media: atomisp: hmm_bo: Rewrite alloc_private_pages() using pages_array helper funcs

Rewrite alloc_private_pages() using pages_array helper funcs.

Note alloc_pages_bulk_array() skips non NULL pages, so switch
the allocating of the pages pointer array to kcalloc to ensure
the pages are initially all set to NULL.

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>
22 months agomedia: atomisp: hmm_bo: Further simplify alloc_private_pages()
Hans de Goede [Sat, 13 Aug 2022 15:47:37 +0000 (17:47 +0200)]
media: atomisp: hmm_bo: Further simplify alloc_private_pages()

Further simplify alloc_private_pages().

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>
22 months agomedia: atomisp: hmm_bo: Simplify alloc_private_pages()
Hans de Goede [Sat, 13 Aug 2022 15:38:45 +0000 (17:38 +0200)]
media: atomisp: hmm_bo: Simplify alloc_private_pages()

Since lack_mem starts initialized to true, alloc_private_pages() will
always set order to HMM_MIN_ORDER aka 0 / will always alloc 1 page at
a time.

So all the magic to decrease order if allocs fail is not necessary
and can be removed.

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>
22 months agomedia: atomisp: Make atomisp_try_fmt_cap() take padding into account
Hans de Goede [Sat, 13 Aug 2022 15:08:44 +0000 (17:08 +0200)]
media: atomisp: Make atomisp_try_fmt_cap() take padding into account

atomisp_try_fmt() gives results with padding included. So when userspace
asks for e.g. 1600x1200 then we should pass 1616x1216 to atomisp_try_fmt()
this will then get adjusted back to 1600x1200 before returning it to
userspace by the atomisp_adjust_fmt() call at the end of atomisp_try_fmt().

This fixes the resolution list in camorama showing resolutions like e.g.
1584x1184 instead of 1600x1200.

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>
22 months agomedia: atomisp: Fix VIDIOC_TRY_FMT
Hans de Goede [Sat, 13 Aug 2022 14:53:00 +0000 (16:53 +0200)]
media: atomisp: Fix VIDIOC_TRY_FMT

atomisp_try_fmt() calls the sensor's try_fmt handler but it does
not copy the result back to the passed in v4l2_pix_format under
some circumstances.

Potentially returning an unsupported resolution to userspace,
which VIDIOC_TRY_FMT is not supposed to do.

atomisp_set_fmt() also uses atomisp_try_fmt() and relies
on this wrong behavior. The VIDIOC_TRY_FMT call passes NULL for
the res_overflow argument where as the atomisp_set_fmt() call
passes non NULL.

Use the res_overflow argument to differentiate between the 2 callers
and always propagate the sensors result in the VIDIOC_TRY_FMT case.

This fixes the resolution list in camorama showing resolutions like e.g.
1584x1184 instead of 1600x1200.

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>
22 months agomedia: atomisp-notes: Add info about sensors v4l2_get_subdev_hostdata() use
Hans de Goede [Sat, 13 Aug 2022 09:01:13 +0000 (11:01 +0200)]
media: atomisp-notes: Add info about sensors v4l2_get_subdev_hostdata() use

Add info about sensors v4l2_get_subdev_hostdata() use, to notes.txt.

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>
22 months agomedia: atomisp-ov2680: Improve ov2680_set_fmt() error handling
Hans de Goede [Sat, 13 Aug 2022 09:03:23 +0000 (11:03 +0200)]
media: atomisp-ov2680: Improve ov2680_set_fmt() error handling

Exit with an error on any i2c-write errors, rather then only
exiting with an error when ov2680_get_intg_factor() fails.

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>
22 months agomedia: atomisp-ov2680: Don't take the input_lock for try_fmt calls.
Hans de Goede [Sat, 13 Aug 2022 08:30:34 +0000 (10:30 +0200)]
media: atomisp-ov2680: Don't take the input_lock for try_fmt calls.

On ov2680_set_fmt() calls with format->which == V4L2_SUBDEV_FORMAT_TRY,
ov2680_set_fmt() does not talk to the sensor, so there is no need to
lock the dev->input_lock mutex in this case.

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>
22 months agomedia: atomisp-ov2680: Fix ov2680_set_fmt()
Hans de Goede [Sat, 13 Aug 2022 08:12:39 +0000 (10:12 +0200)]
media: atomisp-ov2680: Fix ov2680_set_fmt()

On sets actually store the set (closest) format inside ov2680_device.dev,
so that it also properly gets returned by get_fmt.

This fixes the following problem:

1. App does an VIDIOC_SET_FMT 640x480, calling ov2680_set_fmt()
2. Internal buffers (atomisp_create_pipes_stream()) get allocated
   at 640x480 size by atomisp_set_fmt()
3. ov2680_get_fmt() gets called later on and returns 1600x1200
   since ov2680_device.dev was not updated. So things get configured
   to stream at 1600x1200, but the internal buffers created during
   atomisp_create_pipes_stream() do not get updated in size
4. streaming starts, internal buffers overflow and the entire
   machine freezes eventually due to memory being corrupted

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>
22 months agomedia: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed()
Andy Shevchenko [Sat, 30 Jul 2022 15:59:04 +0000 (17:59 +0200)]
media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed()

The acpi_evaluate_dsm_typed() provides a way to check the type of the
object evaluated by _DSM call. Use it instead of open coded variant.

Link: https://lore.kernel.org/r/20220730155905.90091-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: dt-bindings: media: samsung,exynos5250-gsc: convert to dtschema
Krzysztof Kozlowski [Sun, 26 Jun 2022 16:33:00 +0000 (18:33 +0200)]
media: dt-bindings: media: samsung,exynos5250-gsc: convert to dtschema

Convert the Samsung Exynos SoC G-Scaler bindings to DT schema.

Changes done during conversion:
1. A typical (already used) properties like clocks, iommus and
   power-domains.
2. Require clocks, because they are essential for the block to operate.
3. Describe the differences in clocks between the Exynos5250/5420 and
   the Exynos5433 G-Scalers.  This includes the fifth Exynos5433 clock
   "gsd" (GSCL Smart Deck) which was added to the DTS, but not to the
   bindings and Linux driver.  Similarly to Exynos5433 DECON change [1],
   the clock should be used.

[1] https://lore.kernel.org/all/6270db2d-667d-8d6f-9289-be92da486c25@samsung.com/

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: dt-bindings: dongwoon,dw9714: convert to dtschema
Krzysztof Kozlowski [Thu, 1 Sep 2022 07:14:37 +0000 (09:14 +0200)]
media: dt-bindings: dongwoon,dw9714: convert to dtschema

Convert Dongwoon Anatech DW9714 camera voice coil lens driver to DT
schema and extend the bindings with vcc-supply (already used by driver)
and powerdown-gpios (based on datasheet, not used by the driver).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: convert pipeline funcs to take media_pad
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:39 +0000 (16:13 +0200)]
media: mc: convert pipeline funcs to take media_pad

Now that the pipeline is stored into pads instead of entities, we can
change the relevant functions to take pads instead of entities.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Add has_pad_interdep entity operation
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:38 +0000 (16:13 +0200)]
media: mc: entity: Add has_pad_interdep entity operation

Add a new media entity operation, has_pad_interdep. The optional op is
used to discover the pad interdependencies inside an entity during the
pipeline construction.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Rewrite media_pipeline_start()
Laurent Pinchart [Wed, 31 Aug 2022 14:13:37 +0000 (16:13 +0200)]
media: mc: entity: Rewrite media_pipeline_start()

[Note: the code is mostly from Laurent but the patch description is from Tomi]

The media_pipeline_start() and media_pipeline_stop() functions use the
media graph walk API to traverse the graph and validate the pipeline.
The graph walk traverses the media graph following links between the
entities.

Also, while the pipeline can't change between the start and stop calls,
the graph is walked again from scratch at stop time, or any time a
driver needs to inspect the pipeline.

With the upcoming multiplexed streams support we will need a bit more
intelligent pipeline construction, as e.g. two independent streams may
be passing through a single entity via separate pads in which case
those pads should not be part of the same pipeline.

This patch essentially rewrites the media_pipeline_start/stop so that
a pipeline is defined as a set of pads instead of entities and the media
graph traversal considers the pad interdependencies when choosing which
links to follow.

Currently all the entity's pads are considered as interdependent. This
means that the behavior with all the current drivers stays the same, but
in the future we can define a more fine-grained pipeline construction.

Additionally the media pipeline's pads are cached at
media_pipeline_start() time, and re-used at media_pipeline_stop() which
avoid the need to re-walk the whole graph as the previous implementation
did.

Also, caching pads in the pipeline can serve in the future as the
foundation to provide a better API than the media graph walk to drivers
to iterate over pads and entities in the pipeline.

Note that the old media_pipeline_start/stop used the media graph walk
API. The new version does not use the media graph walk API, but instead
a new implementation.

There are two reasons for not changing the graph walk: it proved to be
rather difficult to change the graph walk to have the features
implemented in this patch, and second, this keeps the backward
compatibility of the graph walk as there are users of the graph walk API

The long term plan is that all the existing code would be converted to
use the new cached pipeline, thus allowing us to remove the graph walk.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: drivers: use video_device_pipeline_alloc_start()
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:36 +0000 (16:13 +0200)]
media: drivers: use video_device_pipeline_alloc_start()

Use video_device_pipeline_alloc_start() instead of manually
allocating/managing the media pipeline storage.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: add alloc variant of pipeline_start
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:35 +0000 (16:13 +0200)]
media: mc: entity: add alloc variant of pipeline_start

Add new variant of media_pipeline_start(), media_pipeline_alloc_start().

media_pipeline_alloc_start() can be used by drivers that do not need to
extend the media_pipeline. The function will either use the pipeline
already associated with the entity, if such exists, or allocate a new
pipeline.

When media_pipeline_stop() is called and the pipeline's use count drops
to zero, the pipeline is automatically freed.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: drivers: use video_device_pipeline()
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:34 +0000 (16:13 +0200)]
media: drivers: use video_device_pipeline()

Use video_device_pipeline() in the drivers instead of
media_entity_pipeline().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: drivers: use video device pipeline start/stop
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:33 +0000 (16:13 +0200)]
media: drivers: use video device pipeline start/stop

Convert the media drivers to use video device based pipeline start/stop
where possible.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: v4l2-dev: Add videodev wrappers for media pipelines
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:32 +0000 (16:13 +0200)]
media: v4l2-dev: Add videodev wrappers for media pipelines

With the upcoming stream related improvements to the pipelines, the
pipelines are moved from media entities to media pads. As the drivers
currently use the pipelines with the entity based model, moving the
pipelines to pads will cause changes to the drivers.

However, most of the uses of media pipelines are related to a video
device (a DMA engine) with a single pad, and thus there's never a need
to support multiple pads in these use cases. We can avoid pushing the
complexities of the pad based model to the drivers by adding video
device wrappers for the pipeline related functions.

This patch adds a number of wrappers to media_pipeline functions, all of
which take a video_device as a parameter (instead of a media_entity),
and verify that there's just one pad.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Add media_entity_pipeline() to access the media pipeline
Laurent Pinchart [Wed, 31 Aug 2022 14:13:31 +0000 (16:13 +0200)]
media: mc: entity: Add media_entity_pipeline() to access the media pipeline

Replace direct access to the pipe field in drivers with a new helper
function. This will allow easier refactoring of media pipeline handling
in the MC core behind the scenes without affecting drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Move media_entity_get_fwnode_pad() out of graph walk section
Laurent Pinchart [Wed, 31 Aug 2022 14:13:30 +0000 (16:13 +0200)]
media: mc: entity: Move media_entity_get_fwnode_pad() out of graph walk section

The media_entity_get_fwnode_pad() function is unrelated to the graph
traversal code that it is currently bundled with. Move it with the
media_entity_remote_pad() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Merge media_entity_enum_init and __media_entity_enum_init
Laurent Pinchart [Wed, 31 Aug 2022 14:13:29 +0000 (16:13 +0200)]
media: mc: entity: Merge media_entity_enum_init and __media_entity_enum_init

The media_entity_enum_init() function is a wrapper around
__media_entity_enum_init() that turns a media_device pointer argument
into the maximum entity ID in the corresponding media graph.
__media_entity_enum_init() is never used outside of
media_entity_enum_init(), so the two functions can be merged together.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Add iterator helper for entity pads
Jacopo Mondi [Wed, 31 Aug 2022 14:13:28 +0000 (16:13 +0200)]
media: mc: entity: Add iterator helper for entity pads

Add an iterator helper to easily cycle through all pads in an entity and
use it in media-entity and media-device code where appropriate.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: mc: entity: Rename streaming_count -> start_count
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:27 +0000 (16:13 +0200)]
media: mc: entity: Rename streaming_count -> start_count

'streaming_count' is a bit misleading name, as the count is increased
with media_pipeline_start(). Let's rename it to 'start_count' instead.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: subdev: increase V4L2_FRAME_DESC_ENTRY_MAX to 8
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:26 +0000 (16:13 +0200)]
media: subdev: increase V4L2_FRAME_DESC_ENTRY_MAX to 8

V4L2_FRAME_DESC_ENTRY_MAX is currently set to 4. In theory it's possible
to have an arbitrary amount of streams in a single pad, so preferably
there should be no hardcoded maximum number.

However, I believe a reasonable max is 8, which would cover a CSI-2 pad
with 4 streams of pixel data and 4 streams of metadata.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: media-entity.h: add include for min()
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:25 +0000 (16:13 +0200)]
media: media-entity.h: add include for min()

./include/media/media-entity.h:595:34: error: implicit declaration of function ‘min’

Include minmax.h to get the definition for min().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: Documentation: mc: add definitions for stream and pipeline
Tomi Valkeinen [Wed, 31 Aug 2022 14:13:24 +0000 (16:13 +0200)]
media: Documentation: mc: add definitions for stream and pipeline

The doc talks about streams and pipelines, but doesn't really define
them. This is an attempt to define them according to my understanding.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: Remove incorrect comment from struct v4l2_fwnode_endpoint
Sakari Ailus [Mon, 5 Sep 2022 12:35:34 +0000 (14:35 +0200)]
media: Remove incorrect comment from struct v4l2_fwnode_endpoint

struct v4l2_fwnode_endpoint was zeroed previously apart from the endpoint
information itself when the endpoint properties were parsed. Now this
hasn't been the case for a few years so remove the comment.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: sun6i-mipi-csi2: Depend on PHY_SUN6I_MIPI_DPHY
Sakari Ailus [Mon, 5 Sep 2022 09:52:35 +0000 (11:52 +0200)]
media: sun6i-mipi-csi2: Depend on PHY_SUN6I_MIPI_DPHY

PHY_SUN6I_MIPI_DPHY is not a freely selectable option and so may not
always be available. Depend on it instead.

Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ov8865: Fix an error handling path in ov8865_probe()
Christophe JAILLET [Sun, 7 Aug 2022 06:43:29 +0000 (08:43 +0200)]
media: ov8865: Fix an error handling path in ov8865_probe()

The commit in Fixes also introduced some new error handling which should
goto the existing error handling path.
Otherwise some resources leak.

Fixes: 73dcffeb2ff9 ("media: i2c: Support 19.2MHz input clock in ov8865")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ar0521: Fix return value check in writing initial registers
Sakari Ailus [Tue, 30 Aug 2022 10:32:36 +0000 (12:32 +0200)]
media: ar0521: Fix return value check in writing initial registers

The return value from register writes is ignored apart from the last
value. Fix this.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: v4l: subdev: Fail graciously when getting try data for NULL state
Sakari Ailus [Fri, 26 Aug 2022 11:53:58 +0000 (13:53 +0200)]
media: v4l: subdev: Fail graciously when getting try data for NULL state

The state argument for the functions for obtaining various parts of the
state is NULL if it is called by drivers for active state. Fail graciously
in that case instead of dereferencing a NULL pointer.

Suggested-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ipu3-imgu: Fix NULL pointer dereference in active selection access
Sakari Ailus [Thu, 25 Aug 2022 18:36:37 +0000 (20:36 +0200)]
media: ipu3-imgu: Fix NULL pointer dereference in active selection access

What the IMGU driver did was that it first acquired the pointers to active
and try V4L2 subdev state, and only then figured out which one to use.

The problem with that approach and a later patch (see Fixes: tag) is that
as sd_state argument to v4l2_subdev_get_try_crop() et al is NULL, there is
now an attempt to dereference that.

Fix this.

Also rewrap lines a little.

Fixes: 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct")
Cc: stable@vger.kernel.org # for v5.14 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ar0521: Remove redundant variable ret
Sakari Ailus [Sun, 14 Aug 2022 17:42:13 +0000 (19:42 +0200)]
media: ar0521: Remove redundant variable ret

ret in ar0521_set_fmt is never set to values other than 0. Replace it with
plain 0.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ar0521: fix error return code in ar0521_power_on()
Yang Yingliang [Fri, 15 Jul 2022 08:59:24 +0000 (10:59 +0200)]
media: ar0521: fix error return code in ar0521_power_on()

Return error code if ar0521_write_regs() fails in ar0521_power_on().

Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: i2c: mt9v111: Fix typo 'the the' in comment
Slark Xiao [Fri, 22 Jul 2022 01:52:11 +0000 (03:52 +0200)]
media: i2c: mt9v111: Fix typo 'the the' in comment

Replace 'the the' with 'the' in the comment.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: v4l2: Fix v4l2_i2c_subdev_set_name function documentation
Alexander Stein [Fri, 22 Jul 2022 07:11:31 +0000 (09:11 +0200)]
media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation

The doc says the I²C device's name is used if devname is NULL, but
actually the I²C device driver's name is used.

Fixes: 0658293012af ("media: v4l: subdev: Add a function to set an I²C sub-device's name")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: ov5640: Use runtime PM
Paul Elder [Thu, 21 Jul 2022 07:41:38 +0000 (09:41 +0200)]
media: ov5640: Use runtime PM

Switch to using runtime PM for power management. Make it optional,
however, to support ACPI.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.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>
22 months agomedia: staging: ipu3-imgu: Fix BNR wb gain documentation
Jean-Michel Hautbois [Fri, 17 Jun 2022 08:45:19 +0000 (10:45 +0200)]
media: staging: ipu3-imgu: Fix BNR wb gain documentation

The documentation states that the BNR factor is a multiplier coded as
u3.13 and with a range of (0, 8). This is not correct, as the isp is
adding 1.0 to the gain applied, ie Pout = { Pin * (1 + Gx) }.

It means that a gain of 1.0 should be coded as 0.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.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>
22 months agomedia: hantro: Allows luma and chroma depth to be different
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:59 +0000 (18:21 +0200)]
media: hantro: Allows luma and chroma depth to be different

Luma and chroma depth are set on different hardware registers.
Even if they aren't identical the bitstream can be compliant
to HEVC specifications and decoded by the hardware.

With this patch TSUNEQBD_A_MAIN10_Technicolor_2 conformance test
is successfully decoded.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: hantro: imx8m: Enable 10bit decoding
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:58 +0000 (18:21 +0200)]
media: hantro: imx8m: Enable 10bit decoding

Expose 10bit pixel formats to enable 10bit decoding in IMX8M SoCs.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: Hantro: HEVC: Allows 10-bit bitstream
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:57 +0000 (18:21 +0200)]
media: Hantro: HEVC: Allows 10-bit bitstream

Stop limiting HEVC support to 8-bits bitstreams also
accept 10-bits bitstreams.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: hantro: postproc: Configure output regs to support 10bit
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:56 +0000 (18:21 +0200)]
media: hantro: postproc: Configure output regs to support 10bit

Move output format setting in postproc and make sure that
8/10bit configuration is correctly set.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: hantro: HEVC: Fix chroma offset computation
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:55 +0000 (18:21 +0200)]
media: hantro: HEVC: Fix chroma offset computation

The chroma offset depends of the bitstream depth.
Make sure that ctx->bit_depth is used to compute it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: hantro: HEVC: Fix auxilary buffer size calculation
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:54 +0000 (18:21 +0200)]
media: hantro: HEVC: Fix auxilary buffer size calculation

SAO and FILTER buffers size depend of the bit depth.
Make sure we have enough space for 10bit bitstreams.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: hantro: Store HEVC bit depth in context
Benjamin Gaignard [Mon, 29 Aug 2022 16:21:53 +0000 (18:21 +0200)]
media: hantro: Store HEVC bit depth in context

Store HEVC bit depth in context.
Bit depth is equal to hevc sps bit_depth_luma_minus8 + 8.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: meson: vdec: fix possible refcount leak in vdec_probe()
Hangyu Hua [Tue, 6 Sep 2022 07:46:30 +0000 (09:46 +0200)]
media: meson: vdec: fix possible refcount leak in vdec_probe()

v4l2_device_unregister need to be called to put the refcount got by
v4l2_device_register when vdec_probe fails or vdec_remove is called.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: platform: cros-ec: Add Kuldax to the match table
Rory Liu [Tue, 6 Sep 2022 03:30:16 +0000 (05:30 +0200)]
media: platform: cros-ec: Add Kuldax to the match table

The Google Kuldax device uses the same approach as the Google Brask
which enables the HDMI CEC via the cros-ec-cec driver.

Signed-off-by: Rory Liu <hellojacky0226@hotmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: MAINTAINERS: rectify entry in SAA7146 VIDEO4LINUX-2 DRIVER
Lukas Bulwahn [Mon, 5 Sep 2022 10:29:39 +0000 (12:29 +0200)]
media: MAINTAINERS: rectify entry in SAA7146 VIDEO4LINUX-2 DRIVER

Commit e33fdb5a0249 ("media: saa7146: deprecate hexium_gemini/orion, mxb
and ttpci") moves some media drivers to the staging subsystem, and
unfortunately only partially adjusts the entry in MAINTAINERS.

Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a
broken reference.

As the files matching include/media/drv-intf/saa7146* are moved to
drivers/staging/media/deprecated/saa7146/common, this directory is already
covered by the existing file entry
drivers/staging/media/deprecated/saa7146/.

Repair this file reference in SAA7146 VIDEO4LINUX-2 DRIVER.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
22 months agomedia: MAINTAINERS: adjust entry to zoran driver movement
Lukas Bulwahn [Mon, 5 Sep 2022 10:14:16 +0000 (12:14 +0200)]
media: MAINTAINERS: adjust entry to zoran driver movement

Commit 2a0c28063de2 ("media: zoran: move to mainline") moves the zoran
driver from the staging to the media subsystem, but does not adjust the
entry in MAINTAINERS.

Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a
broken reference.

Repair this file reference in ZR36067 VIDEO FOR LINUX DRIVER.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>