platform/kernel/linux-starfive.git
18 months agomedia: atomisp: gmin_platform: Make DMI quirks take precedence over the _DSM table
Hans de Goede [Fri, 10 Mar 2023 12:34:45 +0000 (12:34 +0000)]
media: atomisp: gmin_platform: Make DMI quirks take precedence over the _DSM table

On some devices the _DSM sensor-info table contains wrong info,
move the DMI quirk handling up to above the _DSM table check
to allow DMI quirks to override wrong info in the _DSM table.

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>
18 months agomedia: atomisp: Remove struct atomisp_sub_device index field
Hans de Goede [Sun, 5 Mar 2023 15:41:02 +0000 (15:41 +0000)]
media: atomisp: Remove struct atomisp_sub_device index field

Remove the struct atomisp_sub_device.

This was used for 2 things:

1. In dev_dbg() messages
2. To set the name of the v4l2_subdev for each struct atomisp_sub_device

Now that only 1 subdev is used neither is useful anymore. Remove the _%d
postfix from the v4l2_subdev name and remove the logging of the asd index
from the dev_dbg() messages.

In case of the atomisp_s_input() check to see if an input/sensor has
already been assigned to another subdev the entire check no longer
makes sense, so instead of changing the dev_err() message there just
drop the entire check.

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>
18 months agomedia: atomisp: Drop support for streaming from 2 sensors at once
Hans de Goede [Sun, 5 Mar 2023 15:05:52 +0000 (15:05 +0000)]
media: atomisp: Drop support for streaming from 2 sensors at once

With support for depth mode gone there really is no need to support
streaming from 2 sensors at once. As discussed and acked on the list
(see Link tag) it is desirable to drop support for this since it
involves quite a lot of special handling / hacks in the code.

This initial commit limits itself to a minimum set of changes to switch
to 1 struct atomisp_sub_device / 1 stream. Further commits will actually
remove / cleanup much of the special handling.

Likewise this initial commit also deliberately skips the opportunity to
turn some multi-line statements into single-line statements, so as to
keep the diff small / easier to review.

Link: https://lore.kernel.org/linux-media/5309d845-063b-6dd9-529d-0f82654290f2@redhat.com/
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: atomisp: Remove atomisp_try_fmt() call from atomisp_set_fmt()
Hans de Goede [Sun, 5 Mar 2023 18:53:15 +0000 (18:53 +0000)]
media: atomisp: Remove atomisp_try_fmt() call from atomisp_set_fmt()

atomisp_set_fmt() first calls:

v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
                 pad, set_fmt, ...);

with v4l2_subdev_format.which set to V4L2_SUBDEV_FORMAT_ACTIVE and then
reduces width + height by padding_w / padding_h followed by calling
atomisp_try_fmt() which then sets res_overflow if the requested resolution
is larger then the sensor's max resolution, but that will never happen
since we are requesting for the result of a set_fmt call minus padding,
so res_overflow will always be false.

And when called with a res_overflow parameter, combined with there
being no overflow then atomisp_try_fmt() does not change the passed
in width/height.

Except when using JPEG or CUSTOM_M10MO_RAW as pixelformat, then
atomisp_try_fmt() does change the width/height but in that case
atomisp_set_fmt actually restores the old widht/height which it
has saved before the atomisp_try_fmt() call. So this too is a no-op.

TL;DR: The atomisp_try_fmt() call in atomisp_set_fmt() is a no-op,
remove it.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: atomisp: Remove unused ATOM_ISP_MAX_WIDTH_TMP and ATOM_ISP_MAX_HEIGHT_TMP
Hans de Goede [Sun, 5 Mar 2023 18:28:35 +0000 (18:28 +0000)]
media: atomisp: Remove unused ATOM_ISP_MAX_WIDTH_TMP and ATOM_ISP_MAX_HEIGHT_TMP

Remove the unused ATOM_ISP_MAX_WIDTH_TMP and ATOM_ISP_MAX_HEIGHT_TMP
defines.

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>
18 months agomedia: atomisp: Remove snr_mbus_fmt local var from atomisp_try_fmt()
Hans de Goede [Sun, 5 Mar 2023 17:52:23 +0000 (17:52 +0000)]
media: atomisp: Remove snr_mbus_fmt local var from atomisp_try_fmt()

snr_mbus_fmt is a local variable pointing to a substruct of another local
variable which really just makes the code harder to read / follow,
so drop it.

And likewise also drop the stream_info local variable.

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>
18 months agomedia: atomisp: Remove custom V4L2_CID_FMT_AUTO control
Hans de Goede [Sun, 5 Mar 2023 17:57:45 +0000 (17:57 +0000)]
media: atomisp: Remove custom V4L2_CID_FMT_AUTO control

The custom V4L2_CID_FMT_AUTO control, which defaults to true
controls whether the atomisp driver will automatically configure
the sensor and ISP settings to match.

This is necessary to make normal v4l2 apps to work. We do eventually
want to add libcamera support, but even then moving this to userspace
does not give any added value, while breaking classic v4l2 apps.

Moreover we really don't know all the exact pipeline constraints,
so moving this to userspace/libcamera will be tricky thus it is best
to keep the current in kernel code for this and make the kernel
unconditionally do this.

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>
18 months agomedia: atomisp: Remove continuous mode related code from atomisp_set_fmt()
Hans de Goede [Sun, 5 Mar 2023 16:39:51 +0000 (16:39 +0000)]
media: atomisp: Remove continuous mode related code from atomisp_set_fmt()

Remove code to check / adjust code between video and preview /
capture and view-finder nodes now that we no longer support
continuous mode and this no longer support streaming from 2
/dev/video# nodes at the same time.

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>
18 months agomedia: atomisp: Remove duplicate atomisp_[start|stop]_streaming() prototypes
Hans de Goede [Sun, 5 Mar 2023 15:46:38 +0000 (15:46 +0000)]
media: atomisp: Remove duplicate atomisp_[start|stop]_streaming() prototypes

atomisp_ioctl.h contains the atomisp_[start|stop]_streaming() function
prototypes 2 times. Drop one of the copies of the prototypes.

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>
18 months agomedia: atomisp: gc0310: Switch over to ACPI powermanagement
Hans de Goede [Sun, 5 Feb 2023 22:42:31 +0000 (22:42 +0000)]
media: atomisp: gc0310: Switch over to ACPI powermanagement

The DSDT of all Windows BYT / CHT devices which I have seen has proper
ACPI powermagement for the clk and regulators used by the sensors.

So there is no need for the whole custom atomisp_gmin custom code to
disable the ACPI pm and directly poke at the PMIC for this.

Replace all the atomisp_gmin usage with using the new
atomisp_register_sensor_no_gmin() / atomisp_unregister_subdev()
helpers which allow registering a sensor with the atomisp code
without using any of the atomisp_gmin power-management code.

Note eventually these calls should be replaced by the standard
v4l2_async_register_subdev_sensor() mechanism.

But this first requires a bunch of work to the atomisp main code
to make it set the necessary fwnodes up, similar to how
drivers/media/pci/intel/ipu3/cio2-bridge.c does this.

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>
18 months agomedia: atomisp: gc0310: Use devm_kzalloc() for data struct
Hans de Goede [Sun, 5 Feb 2023 21:53:25 +0000 (21:53 +0000)]
media: atomisp: gc0310: Use devm_kzalloc() for data struct

Use devm_kzalloc() to allocate the data struct. It is always free-ed as
the last step of probe-error-exit or remove, so it can be devm-managed.

This will make unwinding things easier when support is added to the gc0310
code to use standard GPIO APIs instead of the custom atomisp_gmin code.

This also allows dropping the out_free label and use direct return
on errors.

This may seem like a functional change since the out_free label also
did a v4l2_device_unregister_subdev() but at the 1 changed return
the device is not registered yet, so that always is a no-op and can
be dropped.

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>
18 months agomedia: atomisp: gc0310: Add runtime-pm support
Hans de Goede [Sun, 5 Feb 2023 21:49:33 +0000 (21:49 +0000)]
media: atomisp: gc0310: Add runtime-pm support

Add runtime-pm support. This is a preparation patch for letting
ACPI deal with the regulators and clocks instead of the DIY code
in atomisp_gmin_platform.c.

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>
18 months agomedia: atomisp: gc0310: Delay power-on till streaming is started
Hans de Goede [Sun, 5 Feb 2023 13:32:27 +0000 (13:32 +0000)]
media: atomisp: gc0310: Delay power-on till streaming is started

Move the setting of the mode to stream on, this also allows
delaying power-on till streaming is started.

And drop the deprecated s_power callback since this now no long
is necessary.

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>
18 months agomedia: atomisp: gc0310: Modernize and simply set_fmt(), get_fmt(), etc.
Hans de Goede [Sun, 5 Feb 2023 12:41:27 +0000 (12:41 +0000)]
media: atomisp: gc0310: Modernize and simply set_fmt(), get_fmt(), etc.

There only is 1 supported resolution allowing significant simplification
of the code; and also bring the code up2date with current subdev fmt
handling practices.

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>
18 months agomedia: atomisp: gc0310: Add error_unlock label to s_stream()
Hans de Goede [Sun, 5 Feb 2023 12:12:24 +0000 (12:12 +0000)]
media: atomisp: gc0310: Add error_unlock label to s_stream()

Add error_unlock label + goto error_unlock on error to remove separate
unlock-s in all the error-exit paths.

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>
18 months agomedia: atomisp: gc0310: Add exposure and gain controls
Hans de Goede [Sat, 4 Feb 2023 16:19:27 +0000 (16:19 +0000)]
media: atomisp: gc0310: Add exposure and gain controls

Add exposure and gain controls. This allows controlling
the exposure and gain through standard v4l2 IOCTLs.

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>
18 months agomedia: atomisp: gc0310: Drop custom ATOMISP_IOC_S_EXPOSURE support
Hans de Goede [Sat, 4 Feb 2023 16:01:50 +0000 (16:01 +0000)]
media: atomisp: gc0310: Drop custom ATOMISP_IOC_S_EXPOSURE support

Exposure and gain control should use standard v4l2 controls,
not a custom ioctl.

The next patch in this series will re-add support as standard controls,
this is split into 2 patches for easier reviewing.

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>
18 months agomedia: atomisp: gc0310: Remove read-only exposure control
Hans de Goede [Sat, 4 Feb 2023 15:41:28 +0000 (15:41 +0000)]
media: atomisp: gc0310: Remove read-only exposure control

The sensor does not have automatic exposure so the exposure cannot
change underneath us.

And the control is not marked volatile in it flags,
so the .g_volatile_ctrl callback will never get called.

Remove the current broken read-only (no s_ctrl implementation)
exposure ctrl, this will be replaced with a proper r/w exposure
control relying on the kernel caching the last set value
(so non volatile).

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>
18 months agomedia: atomisp: gc0310: Remove non working flip-controls
Hans de Goede [Sat, 4 Feb 2023 15:39:23 +0000 (15:39 +0000)]
media: atomisp: gc0310: Remove non working flip-controls

The gc0310_[v|h]_flip() functions are empty stubs, remove
the non working controls.

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>
18 months agomedia: atomisp: gc0310: Replace custom reg access functions with smbus helpers
Hans de Goede [Sat, 4 Feb 2023 13:41:29 +0000 (13:41 +0000)]
media: atomisp: gc0310: Replace custom reg access functions with smbus helpers

The gc0310 uses 8 bit register addresses which makes it compatible
with the standard smbus access functions.

Drop the custom reg access helpers, replacing them with the smbus
access functions.

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>
18 months agomedia: atomisp: gc0310: Remove enum gc0310_tok_type
Hans de Goede [Sat, 4 Feb 2023 13:02:52 +0000 (13:02 +0000)]
media: atomisp: gc0310: Remove enum gc0310_tok_type

enum gc0310_tok_type / the data_length read/write parameter
is always GC0310_8BIT, drop this.

Note for the register-lists the indentation is also fixed and
c++ style comments are converted to regular C-style /* */ comments.

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>
18 months agomedia: atomisp: gc0310: Simplify gc0310_write_reg_array()
Hans de Goede [Sat, 4 Feb 2023 12:45:08 +0000 (12:45 +0000)]
media: atomisp: gc0310: Simplify gc0310_write_reg_array()

Remove the complex optimization to send multiple registers in
one i2c-transfer. None of the other sensor drivers are doing this
and the reg-lists are only used once at stream-start time, so
this does not need to be highly optimized.

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>
18 months agomedia: atomisp: gc0310: Remove GC0310_TOK_*
Hans de Goede [Sat, 4 Feb 2023 12:35:23 +0000 (12:35 +0000)]
media: atomisp: gc0310: Remove GC0310_TOK_*

Remove the ability to have special tokens in a reg-list,
GC0310_TOK_DELAY is not used and GC0310_TOK_TERM can be replaced
with ARRAY_SIZE, simplifying the code.

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>
18 months agomedia: atomisp: gc0310: Remove some unused structure definitions
Hans de Goede [Sat, 4 Feb 2023 12:24:15 +0000 (12:24 +0000)]
media: atomisp: gc0310: Remove some unused structure definitions

Drop the unused struct gc0310_format and struct regval_list definitions.

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>
18 months agomedia: atomisp: ov2680: Error handling fixes
Hans de Goede [Sun, 5 Feb 2023 15:05:39 +0000 (15:05 +0000)]
media: atomisp: ov2680: Error handling fixes

Fix 3 error handling issues:

1. In ov2680_s_stream(), when pm_runtime_get_sync() fails it will still
   have incremented the pm-runtime reference count so we need to call
   pm_runtime_put()

2. In ov2680_s_stream() sensor->is_streaming should always be set to false
   when the sensor is powered-off even on i2c-communication errors.

3. In ov2680_probe(), call ov2680_remove() on ov2680_s_config() errors,
   so that pm_runtime_disable() is properly called to disable the
   runtime-pm which has been enabled before the ov2680_s_config() call.

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>
18 months agomedia: atomisp: ov2680: Use v4l2_get_acpi_sensor_info() for the GPIO lookups
Hans de Goede [Sat, 1 Apr 2023 13:25:20 +0000 (14:25 +0100)]
media: atomisp: ov2680: Use v4l2_get_acpi_sensor_info() for the GPIO lookups

Use the new v4l2_get_acpi_sensor_info() for the GPIO lookups,
this uses the special Intel _DSM method to get more info about
the GPIOs like their function and their polarity.

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>
18 months agomedia: atomisp: Add v4l2_get_acpi_sensor_info() helper
Hans de Goede [Fri, 3 Feb 2023 23:23:39 +0000 (23:23 +0000)]
media: atomisp: Add v4l2_get_acpi_sensor_info() helper

ACPI nodes describing sensors on atomisp devices implement a
"79234640-9e10-4fea-a5c1-b5aa8b19756f" Device Specific Method (DSM)
to get info about the GPIOs.

Using this method is necessary to figure out which ACPI GPIO resource
is "reset" and which one is "powerdown" and this is also necessary to
figure out the correct polarity of the pins.

One example where this is necessary is the GC0310 sensor. The current
GC0310 code hardcodes reset as being active-low and power-down as being
active-high. This works on a number of devices such as the mpman
converter 9. But it is wrong for the Chuwi Vi8 CWI501 where the powerdown
pin is active-low.

Rather then adding DMI quirks for this, add a helper for this,
which can be shared between sensor-drivers. This new helper optionally
also returns a string identifying the exact sensor-module used, which
might be useful if any module specific behvior is necessary in the sensor
driver.

This uses the DSM directly on the sensor device's ACPI node. This is
different from later Intel hardware (IPU3 / IPU6) which has a separate
INT3472 node (with its own driver) with this info.

Since there is no separate ACPI node to which we can bind to register GPIO
lookups, this unfortunately means that all sensor drivers which may be used
on BYT or CHT hw need to call this new helper.

Note for now this function is being added to atomisp_gmin_platform.c,
but once things are ready to move atomisp over to using generic sensor
drivers this will need to become a generic v4l2 sensor helper. but this
will require upstream discussion first.

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>
18 months agomedia: atomisp: Remove remaining instance of call to trace_printk
Tsuchiya Yuto [Sun, 17 Oct 2021 16:19:54 +0000 (17:19 +0100)]
media: atomisp: Remove remaining instance of call to trace_printk

(patch based on intel-aero kernel patch:
 https://github.com/intel-aero/meta-intel-aero-base/commit/26fc9fe5030b63bc9dcf0b5f32981948911ca272)

Here is the original commit message from the aforementioned patch:

From 26fc9fe5030b63bc9dcf0b5f32981948911ca272 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@intel.com>
Date: Fri, 7 Jul 2017 14:23:53 -0700
Subject: [PATCH] linux-yocto: Remove remaining instance of call to
 trace_printk

It's not sufficient to leave trace_printk() out of "normal call chains" since
the way trace infrastructure works is that it will allocate the trace_printk
buffers if the symbol is there (by using a separate section for the function
and checking if __start_* and __stop_* symbols are different.

Therefore, even if the default value for the param tells the module to use
printk(), just the fact that it can be changed to trace_printk() means the
initialization code will be called.

The trace_printk() was replaced by pr_info() on commit 3d81099c75a6
("media: atomisp: Replace trace_printk by pr_info") for the upstreamed
atomisp, too. However, as the aforementioned commit message says, there
is still a remaining instance. This causes the "trace_printk() being
used" kernel warning message to still appear on the first driver load.

Based on the aforementioned patch, this patch removes the call to
ftrace_vprintk(). This removes that kernel warning.

In addition to this, this patch also removes the following now unused
things:

    - now empty atomisp_css2_dbg_ftrace_print()
    - trace_printk option from dbg_func kernel parameter

Link: https://lore.kernel.org/r/20211017161958.44351-15-kitakar@gmail.com
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: atomisp: Remove online_process setting
Hans de Goede [Tue, 21 Feb 2023 14:59:06 +0000 (14:59 +0000)]
media: atomisp: Remove online_process setting

online_process is always true, remove it.

Link: https://lore.kernel.org/r/20230221145906.8113-11-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove yuvpp_mode
Hans de Goede [Tue, 21 Feb 2023 14:59:05 +0000 (14:59 +0000)]
media: atomisp: Remove yuvpp_mode

yuvpp_mode is never set, so it always is false remove it.

Link: https://lore.kernel.org/r/20230221145906.8113-10-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove ATOMISP_USE_YUVPP()
Hans de Goede [Tue, 21 Feb 2023 14:59:04 +0000 (14:59 +0000)]
media: atomisp: Remove ATOMISP_USE_YUVPP()

ATOMISP_USE_YUVPP() always returns false, so remove it and remove any
code-paths which only run when it would return true.

Link: https://lore.kernel.org/r/20230221145906.8113-9-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove unused SOC_CAMERA, XENON_FLASH and FILE_INPUT subdev types
Hans de Goede [Tue, 21 Feb 2023 14:59:03 +0000 (14:59 +0000)]
media: atomisp: Remove unused SOC_CAMERA, XENON_FLASH and FILE_INPUT subdev types

Nothing registers subdevs with the SOC_CAMERA, XENON_FLASH and FILE_INPUT
types, remove the code for these.

Link: https://lore.kernel.org/r/20230221145906.8113-8-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove atomisp_get_metadata_type()
Hans de Goede [Tue, 21 Feb 2023 14:59:02 +0000 (14:59 +0000)]
media: atomisp: Remove atomisp_get_metadata_type()

atomisp_get_metadata_type() always returns ATOMISP_MAIN_METADATA,
replace its uses with ATOMISP_MAIN_METADATA and remove it.

Link: https://lore.kernel.org/r/20230221145906.8113-7-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove atomisp_css_enable_raw_binning()
Hans de Goede [Tue, 21 Feb 2023 14:59:01 +0000 (14:59 +0000)]
media: atomisp: Remove atomisp_css_enable_raw_binning()

Remove the now unused atomisp_css_enable_raw_binning() function.

Link: https://lore.kernel.org/r/20230221145906.8113-6-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove crop_needs_override from atomisp_set_fmt()
Hans de Goede [Tue, 21 Feb 2023 14:59:00 +0000 (14:59 +0000)]
media: atomisp: Remove crop_needs_override from atomisp_set_fmt()

Remove the crop_needs_override local helper variable from
atomisp_set_fmt(), as it always is true now.

Link: https://lore.kernel.org/r/20230221145906.8113-5-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: atomisp: Remove delayed_init related code
Hans de Goede [Tue, 21 Feb 2023 14:58:59 +0000 (14:58 +0000)]
media: atomisp: Remove delayed_init related code

After the continues-mode removal the delayed-work never gets queues
remove all the related code.

Link: https://lore.kernel.org/r/20230221145906.8113-4-hdegoede@redhat.com
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>
18 months agomedia: atomisp: Remove continuous mode support
Hans de Goede [Tue, 21 Feb 2023 14:58:58 +0000 (14:58 +0000)]
media: atomisp: Remove continuous mode support

Continues mode is a special mode where 2 /dev/video devices can be active
at the same time. Either the video-preview + video nodes or the
viewfinder (for still capture) + capture nodes.

For the video-preview + video-recording case modern userspace will
use a single stream multiplexed by pipewire.

The still-capture case is extra special only starting the preview
stream and then relying on a custom ATOMISP_IOC_S_CONT_CAPTURE_CONFIG
ioctl to set things up followed by a second stream on to capture
the amount of configured still pictures. While running the sensor
at full resolution all the time. This case too is better handled
with dma-buf + GPU downscaling for the view-finder rather then all this
custom special code. Besises this the ioctl expects a bunch of special
non error checked conditions to be met otherwise things will crash/hang.

The continues mode also involves a special cases all over the code
getting in the way of further cleanups and simplifying the code to
using just 1 /dev/video# node. So lets remove it and the
related custom ATOMISP_IOC_S_CONT_CAPTURE_CONFIG ioctl.

Link: https://lore.kernel.org/linux-media/ea81b17b-7d1f-a5e1-11dd-04db310e1e50@redhat.com/
Link: https://lore.kernel.org/r/20230221145906.8113-3-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: atomisp: Remove depth-mode support
Hans de Goede [Tue, 21 Feb 2023 14:58:57 +0000 (14:58 +0000)]
media: atomisp: Remove depth-mode support

Remove support for depth mode. This is a special mode where 2 streams
(from 2 different sensors) can be setup and then starting/stopping
1 will automatically also start/stop the other.

Like many of these special features I'm pretty sure that if the queue
setup is not done exactly right things will crash and there is no error
checking for this.

This seems to be for stereoscopic vision and the only known hw which
actually supports this is the Intel Aero board/SDK, all other 1000+
BYT/CHT models don't need this.

This false outside of the standard webcam use scenario which we are
trying to get working and this involves a bunch of hacks / special
exceptions all over the code, so lets remove this.

Link: https://lore.kernel.org/linux-media/ea81b17b-7d1f-a5e1-11dd-04db310e1e50@redhat.com/
Link: https://lore.kernel.org/r/20230221145906.8113-2-hdegoede@redhat.com
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>
18 months agomedia: i2c: Drop unused vs6624 camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused vs6624 camera sensor driver

The vs6624 camera sensor driver doesn't support DT and relies on
platform data. The last board files supplying platform data for that
device have been removed from the kernel in v4.17. The driver hasn't
been used since them. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused sr030pc30 camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused sr030pc30 camera sensor driver

The sr030pc30 camera sensor driver doesn't support DT and relies on
platform data. No board file has ever provided platform data for that
device. The driver has thus never been used in the mainline kernel since
its introduction in v2.6.37. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused s5k6aa camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused s5k6aa camera sensor driver

The s5k6aa camera sensor driver doesn't support DT and relies on
platform data. The last board files supplying platform data for that
device have been removed from the kernel in v3.11. The driver hasn't
been used since them. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused noon010pc30 camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused noon010pc30 camera sensor driver

The noon010pc30 camera sensor driver doesn't support DT and relies on
platform data. The last board files supplying platform data for that
device have been removed from the kernel in v3.16. A device tree file
referencing the device has been added in v3.17, but without
corresponding DT bindings, and with DT support in the driver. The driver
thus hasn't been used since v316. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused mt9t001 camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused mt9t001 camera sensor driver

The mt9t001 camera sensor driver doesn't support DT and relies on
platform data. No board file has ever provided platform data for that
device. The driver has thus never been used in the mainline kernel since
its introduction in v3.2. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused mt9m032 camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused mt9m032 camera sensor driver

The mt9m032 camera sensor driver doesn't support DT and relies on
platform data. No board file has ever provided platform data for that
device. The driver has thus never been used in the mainline kernel since
its introduction in v3.4. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused m5mols camera sensor driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused m5mols camera sensor driver

The m5mols camera sensor driver doesn't support DT and relies on
platform data. The last board files supplying platform data for that
device have been removed from the kernel in v3.11. The driver hasn't
been used since them. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: i2c: Drop unused ad9389b video encoder driver
Laurent Pinchart [Wed, 25 Jan 2023 18:29:48 +0000 (18:29 +0000)]
media: i2c: Drop unused ad9389b video encoder driver

The ad9389b video encoder driver doesn't support DT and relies on
platform data. No board file has ever provided platform data for that
device. The driver has thus never been used in the mainline kernel since
its introduction in v3.7. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: imx-jpeg: Encoder add support for 12bit jpeg
Ming Qian [Wed, 22 Mar 2023 05:13:13 +0000 (05:13 +0000)]
media: imx-jpeg: Encoder add support for 12bit jpeg

enable encoding 12-bit extended jpeg

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: imx-jpeg: Decoder add support for 12bit jpeg
Ming Qian [Wed, 22 Mar 2023 05:13:12 +0000 (05:13 +0000)]
media: imx-jpeg: Decoder add support for 12bit jpeg

enable decoding 12-bit extended jpeg

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: imx-jpeg: Clear slot next desc ptr if config error
Ming Qian [Wed, 22 Mar 2023 05:13:11 +0000 (05:13 +0000)]
media: imx-jpeg: Clear slot next desc ptr if config error

clear slot next desc ptr if config error,
otherwise codec will report config error interrupt repeatedly,
it may led to system hang.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: imx-jpeg: Refine the function mxc_jpeg_find_format
Ming Qian [Wed, 22 Mar 2023 05:13:10 +0000 (05:13 +0000)]
media: imx-jpeg: Refine the function mxc_jpeg_find_format

remove the unused parameter ctx

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add ABGR64_12 video format
Ming Qian [Wed, 22 Mar 2023 05:13:09 +0000 (05:13 +0000)]
media: Add ABGR64_12 video format

ABGR64_12 is a reversed RGB format with alpha channel last,
12 bits per component like ABGR32,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add BGR48_12 video format
Ming Qian [Wed, 22 Mar 2023 05:13:08 +0000 (05:13 +0000)]
media: Add BGR48_12 video format

BGR48_12 is a reversed RGB format with 12 bits per component like BGR24,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add YUV48_12 video format
Ming Qian [Wed, 22 Mar 2023 05:13:07 +0000 (05:13 +0000)]
media: Add YUV48_12 video format

YUV48_12 is a YUV format with 12-bits per component like YUV24,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.

[hverkuil: replaced a . by ,]

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add Y212 v4l2 format info
Ming Qian [Wed, 22 Mar 2023 05:13:06 +0000 (05:13 +0000)]
media: Add Y212 v4l2 format info

Y212 is a YUV format with 12-bits per component like YUYV,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.

Add the missing v4l2 foramt info of Y212

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add Y012 video format
Ming Qian [Wed, 22 Mar 2023 05:13:05 +0000 (05:13 +0000)]
media: Add Y012 video format

Y012 is a luma-only formats with 12-bits per pixel,
expanded to 16bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Add P012 and P012M video format
Ming Qian [Wed, 22 Mar 2023 05:13:04 +0000 (05:13 +0000)]
media: Add P012 and P012M video format

P012 is a YUV format with 12-bits per component with interleaved UV,
like NV12, expanded to 16 bits.
Data in the 12 high bits, zeros in the 4 low bits,
arranged in little endian order.
And P012M has two non contiguous planes.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: v4l2-subdev: Add new ioctl for client capabilities
Tomi Valkeinen [Thu, 23 Mar 2023 13:58:35 +0000 (13:58 +0000)]
media: v4l2-subdev: Add new ioctl for client capabilities

Add new ioctls to set and get subdev client capabilities. Client in this
context means the userspace application which opens the subdev device
node. The client capabilities are stored in the file handle of the
opened subdev device node, and the client must set the capabilities for
each opened subdev.

For now we only add a single flag, V4L2_SUBDEV_CLIENT_CAP_STREAMS, which
indicates that the client is streams-aware.

The reason for needing such a flag is as follows:

Many structs passed via ioctls, e.g. struct v4l2_subdev_format, contain
reserved fields (usually a single array field). These reserved fields
can be used to extend the ioctl. The userspace is required to zero the
reserved fields.

We recently added a new 'stream' field to many of these structs, and the
space for the field was taken from these reserved arrays. The assumption
was that these new 'stream' fields are always initialized to zero if the
userspace does not use them. This was a mistake, as, as mentioned above,
the userspace is required to zero the _reserved_ fields. In other words,
there is no requirement to zero this new stream field, and if the
userspace doesn't use the field (which is the case for all userspace
applications at the moment), the field may contain random data.

This shows that the way the reserved fields are defined in v4l2 is, in
my opinion, somewhat broken, but there is nothing to do about that.

To fix this issue we need a way for the userspace to tell the kernel
that the userspace has indeed set the 'stream' field, and it's fine for
the kernel to access it. This is achieved with the new ioctl, which the
userspace should usually use right after opening the subdev device node.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@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>
18 months agomedia: staging: media: av7110: fix VBI output support
Hans Verkuil [Wed, 22 Mar 2023 12:51:56 +0000 (12:51 +0000)]
media: staging: media: av7110: fix VBI output support

With these changes it now passes the v4l2-compliance test.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: pci: saa7146: advertise only those TV standard that are supported
Hans Verkuil [Thu, 2 Mar 2023 12:45:11 +0000 (12:45 +0000)]
media: pci: saa7146: advertise only those TV standard that are supported

V4L2_STD_ALL advertises more standards than these boards
actually support. This causes a V4L2 compliance issue. Limit
the supported standards to those that are actually implemented.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mxb: allow tuner/input/audio ioctls for vbi
Hans Verkuil [Thu, 2 Mar 2023 11:42:57 +0000 (11:42 +0000)]
media: mxb: allow tuner/input/audio ioctls for vbi

The vbi stream comes from the same video input as the video
stream. So all the related ioctls to that are just as valid
for the vbi stream.

Add these.

This fixes a V4L2 compliance issue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: add support for missing .vidioc_try_fmt_vbi_cap
Hans Verkuil [Thu, 2 Mar 2023 11:41:39 +0000 (11:41 +0000)]
media: common: saa7146: add support for missing .vidioc_try_fmt_vbi_cap

Support for VIDIOC_TRY_FMT for the vbi device was missing.
Add it.

This fixes a V4L2 compliance issue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mxb: update the tvnorms when changing input
Hans Verkuil [Thu, 2 Mar 2023 11:39:41 +0000 (11:39 +0000)]
media: mxb: update the tvnorms when changing input

The tuner input uses different tvnorms compared to the
S-Video/Composite inputs. So update the tvnorms field
in struct video_device when switching inputs.

This fixes a V4L2 compliance issue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: allow S_STD(G_STD)
Hans Verkuil [Thu, 2 Mar 2023 11:37:38 +0000 (11:37 +0000)]
media: common: saa7146: allow S_STD(G_STD)

If the requested TV standard is identical to the current
TV standard, then return 0, even when the vb2 queues are
busy.

This fixes a V4L2 compliance issue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: check minimum video format size
Hans Verkuil [Thu, 2 Mar 2023 11:31:24 +0000 (11:31 +0000)]
media: common: saa7146: check minimum video format size

There was no check for the minimum width and height, so
0 values were just passed on. Fix this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: fix compliance problems with field handling
Hans Verkuil [Thu, 2 Mar 2023 11:27:04 +0000 (11:27 +0000)]
media: common: saa7146: fix compliance problems with field handling

The initial field value of the format is ANY, which isn't allowed.
Change to INTERLACED.

VIDIOC_TRY_FMT will overwrite vv->last_field, which is an
unwanted side-effect, so drop this.

And finally vidioc_s_fmt_vid_cap didn't initialize vv->last_field
correctly.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: saa7146: convert to vb2
Hans Verkuil [Wed, 1 Mar 2023 11:05:55 +0000 (11:05 +0000)]
media: saa7146: convert to vb2

Convert this driver from the old videobuf framework to the vb2
frame.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: use for_each_sg_dma_page
Hans Verkuil [Thu, 2 Mar 2023 10:35:05 +0000 (10:35 +0000)]
media: common: saa7146: use for_each_sg_dma_page

When building the pgtables, use for_each_sg_dma_page.

Also clean up the code a bit.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: fix broken V4L2_PIX_FMT_YUV422P support
Hans Verkuil [Thu, 2 Mar 2023 10:21:47 +0000 (10:21 +0000)]
media: common: saa7146: fix broken V4L2_PIX_FMT_YUV422P support

The U and V components were swapped. Drop the FORMAT_BYTE_SWAP
to fix this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: av7110: replace BUG_ON by WARN_ON
Hans Verkuil [Thu, 2 Mar 2023 10:06:40 +0000 (10:06 +0000)]
media: staging: media: av7110: replace BUG_ON by WARN_ON

No need for BUG_ON, WARN_ON is a lot friendlier.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: replace BUG_ON by WARN_ON
Hans Verkuil [Thu, 2 Mar 2023 10:05:58 +0000 (10:05 +0000)]
media: common: saa7146: replace BUG_ON by WARN_ON

No need for BUG_ON, WARN_ON is a lot friendlier.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: drop 'fmt' from struct saa7146_buf
Hans Verkuil [Thu, 2 Mar 2023 09:52:59 +0000 (09:52 +0000)]
media: common: saa7146: drop 'fmt' from struct saa7146_buf

Use the video_fmt in saa7146_vv instead of having a pointer
to it in struct saa7146_buf.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: saa7146: drop 'dev' and 'resources' from struct saa7146_fh
Hans Verkuil [Wed, 1 Mar 2023 12:21:38 +0000 (12:21 +0000)]
media: saa7146: drop 'dev' and 'resources' from struct saa7146_fh

Instead use vv->resources and video_drvdata(file) to
obtain this information.

This prepares for the vb2 conversion later when saa7146_fh is
dropped completely.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: pci: saa7146: hexium_orion: initialize input 0
Hans Verkuil [Thu, 23 Mar 2023 15:13:41 +0000 (15:13 +0000)]
media: pci: saa7146: hexium_orion: initialize input 0

When this driver is loaded for the first time, input 0 is
not initialized. In order to capture from that input you would
have to switch to input 1, then back to 0.

Properly initialize the input when the driver is loaded.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common/saa7146: fix VFL direction for vbi output
Hans Verkuil [Wed, 22 Mar 2023 12:51:36 +0000 (12:51 +0000)]
media: common/saa7146: fix VFL direction for vbi output

The VBI output device didn't have VFL_DIR_TX set, so this didn't work
anymore since the V4L2 core thought that it was a capture device instead.

Fix this. Also drop invalid capabilities for the VBI output device.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: common: saa7146: disable clipping
Hans Verkuil [Thu, 23 Mar 2023 15:11:20 +0000 (15:11 +0000)]
media: common: saa7146: disable clipping

The patch removing overlay support also removed the old
saa7146_disable_clipping() function, but that is needed in order
to capture video. Without this the Hexium cards won't show any
video.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 7777694f8066 ("media: saa7146: drop overlay support")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: dt-bindings: media: renesas,vsp1: Document RZ/V2L VSPD bindings
Biju Das [Thu, 6 Apr 2023 17:13:24 +0000 (18:13 +0100)]
media: dt-bindings: media: renesas,vsp1: Document RZ/V2L VSPD bindings

Document VSPD found in RZ/V2L SoC. The VSPD block is identical to RZ/G2L
SoC and therefore use RZ/G2L fallback to avoid any driver changes.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: dt-bindings: media: renesas,fcp: Document RZ/{G2L,V2L} FCPVD bindings
Biju Das [Thu, 6 Apr 2023 17:13:23 +0000 (18:13 +0100)]
media: dt-bindings: media: renesas,fcp: Document RZ/{G2L,V2L} FCPVD bindings

Document FCPVD found in RZ/G2L alike SoCs. FCPVD block is similar to
FCP for VSP found on R-Car SoC's . It has 3 clocks compared to 1
clock on fcpv. Introduce new compatibles renesas,r9a07g044-fcpvd
for RZ/G2{L,LC} and renesas,r9a07g054-fcpvd for RZ/V2L to handle this
difference.

The 3 clocks are shared between du, vspd and fcpvd. No driver changes
are required as generic compatible string "renesas,fcpv" will be used
as a fallback.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mediatek: vcodec: Coverity issues in encoder driver
Irui Wang [Mon, 3 Apr 2023 09:43:42 +0000 (10:43 +0100)]
media: mediatek: vcodec: Coverity issues in encoder driver

CERT-C Characters and Strings:
check core id is in valid range:
dev->reg_base[dev->venc_pdata->core_id] evaluates to an address
that could be at negative offset of an array.

CERT-C Expression:
check buf is not NULL before used:
Dereferencing buf, which is known to be NULL.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup
Wei Chen [Wed, 29 Mar 2023 08:05:13 +0000 (09:05 +0100)]
media: mediatek: vcodec: Fix potential array out-of-bounds in decoder queue_setup

variable *nplanes is provided by user via system call argument. The
possible value of q_data->fmt->num_planes is 1-3, while the value
of *nplanes can be 1-8. The array access by index i can cause array
out-of-bounds.

Fix this bug by checking *nplanes against the array size.

Signed-off-by: Wei Chen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mediatek: vcodec: add remove function for decoder platform driver
Yunfei Dong [Tue, 28 Mar 2023 09:14:50 +0000 (10:14 +0100)]
media: mediatek: vcodec: add remove function for decoder platform driver

Need to disable decoder power when remove decoder hardware driver, adding
remove callback function in the definition of platform driver.

Fixes: c05bada35f01 ("media: mtk-vcodec: Add to support multi hardware decode")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mediatek: vcodec: fix decoder disable pm crash
Yunfei Dong [Tue, 28 Mar 2023 09:14:49 +0000 (10:14 +0100)]
media: mediatek: vcodec: fix decoder disable pm crash

Can't call pm_runtime_disable when the architecture support sub device for
'dev->pm.dev' is NUll, or will get below crash log.

[   10.771551] pc : _raw_spin_lock_irq+0x4c/0xa0
[   10.771556] lr : __pm_runtime_disable+0x30/0x130
[   10.771558] sp : ffffffc01e4cb800
[   10.771559] x29: ffffffc01e4cb800 x28: ffffffdf082108a8
[   10.771563] x27: ffffffc01e4cbd70 x26: ffffff8605df55f0
[   10.771567] x25: 0000000000000002 x24: 0000000000000002
[   10.771570] x23: ffffff85c0dc9c00 x22: 0000000000000001
[   10.771573] x21: 0000000000000001 x20: 0000000000000000
[   10.771577] x19: 00000000000000f4 x18: ffffffdf2e9fbe18
[   10.771580] x17: 0000000000000000 x16: ffffffdf2df13c74
[   10.771583] x15: 00000000000002ea x14: 0000000000000058
[   10.771587] x13: ffffffdf2de1b62c x12: ffffffdf2e9e30e4
[   10.771590] x11: 0000000000000000 x10: 0000000000000001
[   10.771593] x9 : 0000000000000000 x8 : 00000000000000f4
[   10.771596] x7 : 6bff6264632c6264 x6 : 0000000000008000
[   10.771600] x5 : 0080000000000000 x4 : 0000000000000001
[   10.771603] x3 : 0000000000000008 x2 : 0000000000000001
[   10.771608] x1 : 0000000000000000 x0 : 00000000000000f4
[   10.771613] Call trace:
[   10.771617]  _raw_spin_lock_irq+0x4c/0xa0
[   10.771620]  __pm_runtime_disable+0x30/0x130
[   10.771657]  mtk_vcodec_probe+0x69c/0x728 [mtk_vcodec_dec 800cc929d6631f79f9b273254c8db94d0d3500dc]
[   10.771662]  platform_drv_probe+0x9c/0xbc
[   10.771665]  really_probe+0x13c/0x3a0
[   10.771668]  driver_probe_device+0x84/0xc0
[   10.771671]  device_driver_attach+0x54/0x78

Fixes: ba31a5b39400 ("media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: hantro: use devm_reset_control_array_get_optional_exclusive()
Ye Xingchen [Fri, 24 Mar 2023 03:07:31 +0000 (03:07 +0000)]
media: hantro: use devm_reset_control_array_get_optional_exclusive()

Switch to devm_reset_control_array_get_optional_exclusive() API.

Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: dt-bindings: media: renesas,vin: Add binding for V4H
Niklas Söderlund [Thu, 30 Mar 2023 14:47:31 +0000 (15:47 +0100)]
media: dt-bindings: media: renesas,vin: Add binding for V4H

Document support for the VIN module in the Renesas V4H (r8a779g0) SoC.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: dt-bindings: media: renesas,csi2: Add binding for V4H
Niklas Söderlund [Thu, 30 Mar 2023 14:47:30 +0000 (15:47 +0100)]
media: dt-bindings: media: renesas,csi2: Add binding for V4H

Document support for the CSI-2 module in the Renesas V4H (r8a779g0) SoC.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: dt-bindings: media: renesas,isp: Add binding for V4H
Niklas Söderlund [Thu, 30 Mar 2023 14:47:29 +0000 (15:47 +0100)]
media: dt-bindings: media: renesas,isp: Add binding for V4H

Document support for the ISP module in the Renesas V4H (r8a779g0) SoC.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: sun6i-isp: Convert to platform remove callback returning void
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:06 +0000 (16:40 +0100)]
media: staging: media: sun6i-isp: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: sunxi: cedrus: Convert to platform remove callback returning...
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:05 +0000 (16:40 +0100)]
media: staging: media: sunxi: cedrus: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: rkvdec: Convert to platform remove callback returning void
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:04 +0000 (16:40 +0100)]
media: staging: media: rkvdec: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: omap4iss: Convert to platform remove callback returning void
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:03 +0000 (16:40 +0100)]
media: staging: media: omap4iss: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: meson: vdec: Convert to platform remove callback returning...
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:02 +0000 (16:40 +0100)]
media: staging: media: meson: vdec: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: imx8mq-mipi-csi2: Convert to platform remove callback returnin...
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:01 +0000 (16:40 +0100)]
media: staging: media: imx8mq-mipi-csi2: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: imx6-mipi-csi2: Convert to platform remove callback returning...
Uwe Kleine-König [Mon, 3 Apr 2023 15:40:00 +0000 (16:40 +0100)]
media: staging: media: imx6-mipi-csi2: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: imx-media-dev: Convert to platform remove callback returning...
Uwe Kleine-König [Mon, 3 Apr 2023 15:39:59 +0000 (16:39 +0100)]
media: staging: media: imx-media-dev: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: imx-media-csi: Convert to platform remove callback returning...
Uwe Kleine-König [Mon, 3 Apr 2023 15:39:58 +0000 (16:39 +0100)]
media: staging: media: imx-media-csi: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: atmel-sama7g5-isc: Convert to platform remove callback returni...
Uwe Kleine-König [Mon, 3 Apr 2023 15:39:57 +0000 (16:39 +0100)]
media: staging: media: atmel-sama7g5-isc: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: staging: media: atmel-sama5d2-isc: Convert to platform remove callback returni...
Uwe Kleine-König [Mon, 3 Apr 2023 15:39:56 +0000 (16:39 +0100)]
media: staging: media: atmel-sama5d2-isc: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

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

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: Documentation: admin-guide: cec.rst: document NTP issue
Hans Verkuil [Mon, 27 Mar 2023 08:32:01 +0000 (09:32 +0100)]
media: Documentation: admin-guide: cec.rst: document NTP issue

The CEC pin framework is affected by NTP daemons speeding up or slowing
down the system clock. Document this and explain how to fix this for
chronyd.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: cec: core: not all messages were passed on when monitoring
Hans Verkuil [Fri, 24 Mar 2023 14:52:57 +0000 (14:52 +0000)]
media: cec: core: not all messages were passed on when monitoring

The valid_la boolean is used to check if the destination logical
address is either 15 (broadcast) or our logical address. If it is
for another logical address, then only adapters that have the
CEC_CAP_MONITOR_ALL capability can pass it on.

However, it is also used to do more detailed validity checks,
such as whether the message was broadcast when it should have been
directed, or vice versa, in which case the message must be ignored
according to the spec. But that should not apply to monitoring.

Add a new bool that just checks the LA and nothing else.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: verisilicon: Fix crash when probing encoder
Benjamin Gaignard [Thu, 13 Apr 2023 10:47:56 +0000 (12:47 +0200)]
media: verisilicon: Fix crash when probing encoder

ctx->vpu_dst_fmt is no more initialized before calling hantro_try_fmt()
so assigne it to vpu_fmt led to crash the kernel.
Like for decoder case use 'fmt' as format for encoder and clean up
the code.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: db6f68b51e5c ("media: verisilicon: Do not set context src/dst formats in reset functions")
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
19 months agomedia: Use designated initializers for all subdev pad ops
Laurent Pinchart [Wed, 15 Feb 2023 15:18:39 +0000 (17:18 +0200)]
media: Use designated initializers for all subdev pad ops

Structures passed to subdev pad operations are all zero-initialized when
declaring variables. In most cases, this is done with designated
initializers to initialize some of the fields to specific values, but in
a minority of cases the structures are zero-initialized by assigning
them to '{ 0 }' or '{ }'.

Improve coding style consistency by using designated initializers where
possible, always initializing the 'which' field.

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>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>