aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
AgeCommit message (Collapse)Author
2022-08-06Merge tag 'sound-6.0-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "As the diffstat shows, we've had lots of developments in a wide range at this time; the majority of changes are about ASoC, including subsystem-wide cleanups, continued SOF / Intel updates and a bunch of new drivers (as usual), while there have been some significant (but almost invisible) improvements in ALSA core side, too. Below are some highlights: Core: - Faster lookups of control elements with Xarray; normal user won't notice, but on the devices with tons of control elements, it can be visibly faster - Support for input validation for controls; this will harden for badly written drivers in general with a slight overhead - Deferred async signal handling for working around the potential deadlocks - Cleanup / refactoring raw MIDI locking code ASoC: - Restructing of the set_fmt() callbacks for making things clearer in situations like CODEC to CODEC links - Clean up and modernizing the DAI naming scheme setups - Merge of more of the Intel AVS driver stack, including some board integrations - New version 4 mechanism for communication with SOF DSPs - Suppoort for dynamically selecting the PLL to use at runtime on i.MX platforms - Improvements for CODEC to CODEC support in the generic cards - Support for AMD Jadeite and various machines, AMD RPL, Intel MetorLake DSPs, Mediatek MT8186 DSPs and MT6366, nVidia Tegra MDDRC, OPE and PEQ, NXP TFA9890, Qualcomm SDM845, WCD9335 and WAS883x, and Texas Instruments TAS2780 HD- and USB-audio: - Continued improvement for CS35L41 (sub)codec support - More quirks for various devices (HP, Lenovo, Dell, Clevo)" * tag 'sound-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (778 commits) ALSA: hda/realtek: Add quirk for HP Spectre x360 15-eb0xxx ALSA: line6: Replace sprintf() with sysfs_emit() ALSA: hda: Replace sprintf() with sysfs_emit() ALSA: pcm: Replace sprintf() with sysfs_emit() ALSA: core: Replace scnprintf() with sysfs_emit() ALSA: control-led: Replace sprintf() with sysfs_emit() ALSA: aoa: Replace sprintf() with sysfs_emit() ALSA: ac97: Replace sprintf() with sysfs_emit() ALSA: hda/realtek: Add quirk for Clevo NV45PZ ALSA: hda/realtek: Add quirk for Lenovo Yoga9 14IAP7 ALSA: control: Use deferred fasync helper ALSA: pcm: Use deferred fasync helper ALSA: timer: Use deferred fasync helper ALSA: core: Add async signal helpers ASoC: q6asm: use kcalloc() instead of kzalloc() ACPI: scan: Add CLSA0101 Laptop Support ALSA: hda: cs35l41: Support CLSA0101 ALSA: hda: cs35l41: Use the CS35L41 HDA internal define ASoC: dt-bindings: use spi-peripheral-props.yaml ASoC: codecs: va-macro: use fsgen as clock ...
2022-08-04Merge tag 'spdx-6.0-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx Pull SPDX updates from Greg KH: "Here is the set of SPDX comment updates for 6.0-rc1. Nothing huge here, just a number of updated SPDX license tags and cleanups based on the review of a number of common patterns in GPLv2 boilerplate text. Also included in here are a few other minor updates, two USB files, and one Documentation file update to get the SPDX lines correct. All of these have been in the linux-next tree for a very long time" * tag 'spdx-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx: (28 commits) Documentation: samsung-s3c24xx: Add blank line after SPDX directive x86/crypto: Remove stray comment terminator treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_406.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_398.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_391.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_390.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_385.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_319.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_318.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_298.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_292.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_179.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 2) treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 1) treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_160.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_152.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_149.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_147.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_133.RULE ...
2022-08-02venus: pm_helpers: Fix warning in OPP during probeStanimir Varbanov
Fix the following WARN triggered during Venus driver probe on 5.19.0-rc8-next-20220728: WARNING: CPU: 7 PID: 339 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x49c/0x610 Modules linked in: qcom_spmi_adc5 rtc_pm8xxx qcom_spmi_adc_tm5 leds_qcom_lpg led_class_multicolor qcom_pon qcom_vadc_common venus_core(+) qcom_spmi_temp_alarm v4l2_mem2mem videobuf2_v4l2 msm(+) videobuf2_common crct10dif_ce spi_geni_qcom snd_soc_sm8250 i2c_qcom_geni gpu_sched snd_soc_qcom_common videodev qcom_q6v5_pas soundwire_qcom drm_dp_aux_bus qcom_stats drm_display_helper qcom_pil_info soundwire_bus snd_soc_lpass_va_macro mc qcom_q6v5 phy_qcom_snps_femto_v2 qcom_rng snd_soc_lpass_macro_common snd_soc_lpass_wsa_macro lpass_gfm_sm8250 slimbus qcom_sysmon qcom_common qcom_glink_smem qmi_helpers qcom_wdt mdt_loader socinfo icc_osm_l3 display_connector drm_kms_helper qnoc_sm8250 drm fuse ip_tables x_tables ipv6 CPU: 7 PID: 339 Comm: systemd-udevd Not tainted 5.19.0-rc8-next-20220728 #4 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : dev_pm_opp_set_config+0x49c/0x610 lr : dev_pm_opp_set_config+0x58/0x610 sp : ffff8000093c3710 x29: ffff8000093c3710 x28: ffffbca3959d82b8 x27: ffff8000093c3d00 x26: ffffbca3959d8e08 x25: ffff4396cac98118 x24: ffff4396c0e24810 x23: ffff4396c4272c40 x22: ffff4396c0e24810 x21: ffff8000093c3810 x20: ffff4396cac36800 x19: ffff4396cac96800 x18: 0000000000000000 x17: 0000000000000003 x16: ffffbca3f4edf198 x15: 0000001cba64a858 x14: 0000000000000180 x13: 000000000000017e x12: 0000000000000000 x11: 0000000000000002 x10: 0000000000000a60 x9 : ffff8000093c35c0 x8 : ffff4396c4273700 x7 : ffff43983efca6c0 x6 : ffff43983efca640 x5 : 00000000410fd0d0 x4 : ffff4396c4272c40 x3 : ffffbca3f5d1e008 x2 : 0000000000000000 x1 : ffff4396c2421600 x0 : ffff4396cac96860 Call trace: dev_pm_opp_set_config+0x49c/0x610 devm_pm_opp_set_config+0x18/0x70 vcodec_domains_get+0xb8/0x1638 [venus_core] core_get_v4+0x1d8/0x218 [venus_core] venus_probe+0xf4/0x468 [venus_core] platform_probe+0x68/0xd8 really_probe+0xbc/0x2a8 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0xf0 __driver_attach+0x70/0x120 bus_for_each_dev+0x70/0xc0 driver_attach+0x24/0x30 bus_add_driver+0x150/0x200 driver_register+0x64/0x120 __platform_driver_register+0x28/0x38 qcom_venus_driver_init+0x24/0x1000 [venus_core] do_one_initcall+0x54/0x1c8 do_init_module+0x44/0x1d0 load_module+0x16c8/0x1aa0 __do_sys_finit_module+0xbc/0x110 __arm64_sys_finit_module+0x20/0x30 invoke_syscall+0x44/0x108 el0_svc_common.constprop.0+0xcc/0xf0 do_el0_svc+0x2c/0xb8 el0_svc+0x2c/0x88 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x18c/0x190 qcom-venus: probe of aa00000.video-codec failed with error -16 The fix is re-ordering the code related to OPP core. The OPP core expects all configuration options to be provided before the OPP table is added. Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> Suggested-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-07-27media: sunxi: sun6i_mipi_csi2.c/sun8i_a83t_mipi_csi2.c: clarify error handlingHans Verkuil
Both sun6i_mipi_csi2.c and sun8i_a83t_mipi_csi2.c have the same issue: the comment before the ret = 0 assignment is incorrect, drop it and always assign the result of the v4l2_subdev_call(..., 0) to ret. In the disable label check for !on and set ret to 0 in that case. This fixes two smatch warnings: drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c:193 sun6i_mipi_csi2_s_stream() warn: missing error code 'ret' drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c:225 sun8i_a83t_mipi_csi2_s_stream() warn: missing error code 'ret' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-27media: uvcvideo: Fix invalid pointer in uvc_ctrl_init_ctrl()Laurent Pinchart
The handling of per-device mappings introduced in commit 86f7ef773156 ("media: uvcvideo: Add support for per-device control mapping overrides") overwrote the mapping variable after it was initialized and before it was used, leading to usage of an invalid pointer for devices with per-device mappings. Fix it. Fixes: 86f7ef773156 ("media: uvcvideo: Add support for per-device control mapping overrides") Signed-off-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>
2022-07-27media: vimc: wrong pointer is used with PTR_ERRHans Verkuil
Fix smatch warning: drivers/media/test-drivers/vimc/vimc-core.c:214 vimc_create_links() warn: passing a valid pointer to 'PTR_ERR' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: debug: Add dump file in debugfs for MI main path registersPaul Elder
Add a register dump file in debugfs for some of the buffer-related registers for the main path in MI (for the base address, the size, and the offset). Also dump the corresponding shadow registers. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Make the internal CSI-2 receiver optionalLaurent Pinchart
Not all ISP versions integrate a MIPI CSI-2 receiver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Add infrastructure to support ISP featuresLaurent Pinchart
Different ISP versions implement different sets of features. The driver already takes the version into account in several places, but this approach won't scale well for features that are found in different versions. Introduce a new mechanism using a features bitmask in the rkisp1_info structure to indicate which features the ISP support. The first feature bit tells if the ISP has an internal CSI-2 receiver, which is not available in all ISP versions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Support the ISP parallel inputPaul Elder
The ISP has a parallel input, exposed through port 1 in the device tree node. While the driver supports configuring the ISP for the parallel and BT.656 input modes, the DT parsing code, the subdev bound handler and the ISP stream start handler only support the CSI input. Extend them to support the parallel input. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Use fwnode_graph_for_each_endpointPaul Elder
When registering the notifier, replace the manual while loop with fwnode_graph_for_each_endpoint. This simplifies error handling. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Plumb the CSI RX subdevLaurent Pinchart
Connect the CSI receiver subdevice between the sensors and the ISP. This includes: - Calling the subdevice via the v4l2 subdev API - Moving the async notifier for the sensor from the ISP to the CSI receiver - In the ISP, create a media link to the CSI receiver, and remove the media link creation to the sensor - In the CSI receiver, create a media link to the sensor Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Implement a V4L2 subdev for the CSI receiverPaul Elder
The CSI receiver is a component separate from the ISP or the resizers. It is actually optional, not all device model include a CSI receiver. On some SoCs CSI-2 support can be provided through an external CSI-2 receiver, connected to the ISP's parallel input. To support those use cases, create a V4L2 subdev to model the CSI receiver. It will allow the driver to handle both internal and external CSI receivers the same way. The next commit will plumb the CSI subdev to the rest of the driver, replacing direct function calls. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Disallow multiple active sourcesLaurent Pinchart
The ISP supports multiple source subdevs, but can only capture from a single one at a time. The source is selected through link setup. The driver finds the active source in its .s_stream() handler using the media_entity_remote_pad() function. This fails to reject invalid configurations with multiple active sources. Fix it by using the media_pad_remote_pad_unique() helper instead, and inline rkisp1_isp_get_source() in rkisp1_isp_s_stream() as the function is small and has a single caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Rename rkisp1_get_remote_source()Laurent Pinchart
Rename the rkisp1_get_remote_source() function to rkisp1_isp_get_source() to use a consistent rkisp1_isp_* prefix for all ISP functions, and drop the "remote" as the source can't be local. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Constify various local variablesLaurent Pinchart
A set of local variables point to structure that are not meant to be modified. Constify them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Fix whitespace issuesLaurent Pinchart
Add missing blank lines after variable declaration blocks, and fix indentation issues. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Initialize some variables at declaration timeLaurent Pinchart
Initialize the src_fmt and sink_fmt variable when declaring them in rkisp1_config_isp(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Merge ISP_ACQ_PROP configuration in single variableLaurent Pinchart
The rkisp1_config_isp() function stores the value of the input selection and polarity configuration in two different local variables, OR'ed together when writing the register. Merge them into a single acq_prop variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Move input configuration to rkisp1_config_isp()Laurent Pinchart
The ISP_ACQ_PROP register is set twice, once in rkisp1_config_isp() for most of its fields, and once in rkisp1_config_dvp() (called from rkisp1_config_path()) to configure the input selection field. Move the latter to rkisp1_config_isp() to write the register once only, and drop the now empty rkisp1_config_dvp() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Pass rkisp1_isp pointer to internal ISP functionsLaurent Pinchart
Replace the rkisp1_device pointer argument to the internal functions of the ISP implementation with a rkisp1_isp object. This makes the code flow more logical, as the functions operate on the ISP object. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Add rkisp1_device backpointer to rkisp1_ispLaurent Pinchart
The rkisp1_isp structure documentation mentions a backpointer field to rkisp1_device, but the field is missing. Add it, and use it to replace more complicated constructs using container_of() on the v4l2_device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Add container_of wrapper to cast subdev to rkisp1_ispLaurent Pinchart
Replace manual container_of() calls with a static inline wrapper to increase readability. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Rename rkisp1_device.active_sensor to sourceLaurent Pinchart
The active_sensor field of the rkisp1_device structure points to the ASD data for the active source. The source may however not be a sensor, so the naming is a bit confusing. Furthermore, the driver doesn't need to access the full ASD from the active_sensor field, only the subdev pointer is needed, when stopping streaming. Rename the field to source, and turn it into a v4l2_subdev pointer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Pass mbus type and flags to rkisp1_config_cif()Laurent Pinchart
To prepare for the removal of the active_sensor field from the rkisp1_device structure, pass the media bus type of flag to the rkisp1_config_cif() function instead of accessing them through active_sensor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Don't initialize ret to 0 in rkisp1_isp_s_stream()Laurent Pinchart
The ret variable doesn't need to be initialized in rkisp1_isp_s_stream(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Constify argument to rkisp1_csi_start()Laurent Pinchart
The sensor argument to rkisp1_csi_start() isn't meant to be modified by the function. Make it const. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Pass sensor pointer to rkisp1_csi_config()Laurent Pinchart
To prepare for the removal of the active_sensor field from the rkisp1_device structure, pass the sensor pointer to the rkisp1_csi_config() function instead of accessing it through active_sensor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Move start delay to rkisp1_csi_start()Laurent Pinchart
The delay in rkisp1_isp_start() is related to the CSI-2 receiver and the camera sensor. Move it where it belongs, to rkisp1_csi_start(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Rename CSI functions with a common rkisp1_csi prefixLaurent Pinchart
The CSI-related functions are not named consistently. Fix it by using a common rkisp1_csi prefix. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: csi: Handle CSI-2 RX configuration fully in rkisp1-csi.cLaurent Pinchart
The ISP layer now calls multiple functions of the CSI-2 RX layer to configure, start and stop it, with the steps for the last two operations. Move those calls to rkisp1_mipi_csi2_start() and rkisp1_mipi_csi2_stop() to simplify the ISP code and the API exposed by the CSI-2 receiver component. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: isp: Start CSI-2 receiver before ISPLaurent Pinchart
Make sure the ISP is ready to receive data before starting the CSI-2 receiver by starting it first. Similarly, stop the CSI-2 receiver before the ISP when stopping streaming. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Split CSI handling to separate filePaul Elder
Not all ISP instances include a MIPI CSI-2 receiver. To prepare for making it optional, move code related to the CSI-2 receiver to a separate file. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Fix sensor source pad retrieval at bound timeLaurent Pinchart
When a sensor is bound, its source pad is retrieved in the .bound() operation with a call to media_entity_get_fwnode_pad(). The function should be called with the source endpoint fwnode of the sensor, but is instead called with the sensor's device fwnode. Fix this, which involves storing a reference to the source endpoint fwnode in the rkisp1_sensor_async structure, and thus implementing the subdev notifier .destroy() operation to release the reference. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Rename rkisp1_subdev_notifier() to ↵Laurent Pinchart
rkisp1_subdev_notifier_register() The function name isn't very clear, rename it to rkisp1_subdev_notifier_register(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Create internal links at probe timeLaurent Pinchart
There's no need to wait until all async subdevs are bound before creating internal links. Create them at probe time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Create link from sensor to ISP at notifier bound timeLaurent Pinchart
Links from sensors to the ISP can be created as sensors are bound. Move the link creation from rkisp1_create_links() to the bound notifier, and clean up the rkisp1_create_links() function while at it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Reject sensors without pixel rate control at bound timeLaurent Pinchart
The rkisp1 driver requires the sensor to implement the pixel rate control. Trying to operate without it will cause an error when starting streaming. Catch the issue earlier, at bound time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Move sensor .s_stream() call to ISPLaurent Pinchart
Move the calls to the active sensor's .s_stream() operation to the ISP subdev's .s_stream(). This groups all handling of the active sensor in one place, preparing for a rework of that code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: cap: Print debug message on failed link validationLaurent Pinchart
When a link validation failure occurs, print a debug message to help diagnosing the cause. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Make rkisp1_isp_mbus_info commonPaul Elder
The upcoming CSI receiver split from the ISP to a separate source file will need to be able to access the list of formats supported by the driver. Move it out of the ISP's header and into the common header, and add helper functions for accessing it so that the format list doesn't need to be stored in the header. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Access ISP version from info pointerLaurent Pinchart
The ISP version is stored in the media_device hw_revision field and access from there in the driver. Now that we store a pointer to the match data in the rkisp1_device structure, access the ISP version from there to make the code clearer and avoid depending on the media_device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Save info pointer in rkisp1_devicePaul Elder
To make it possible to use the rkisp1_info after probe time (for instance to make code conditional on the ISP version), save it in the main rkisp1_device structure. To achieve this, also move the info structure into the common header, and document it. While at it, drop a NULL check in rkisp1_probe() for the match data as it can't happen. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Rename rkisp1_match_data to rkisp1_infoLaurent Pinchart
The rkisp1_match_data structure contains device model-specific information. It it referenced from OF match data, but that's an implementation detail. Rename it to rkisp1_info to reflect its main purpose. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Read the ID register at probe time instead of streamonLaurent Pinchart
There's no need to read the ID register every time streaming is started. Do it once, at probe time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Disable runtime PM in probe error pathLaurent Pinchart
If the v4l2_device_register() call fails, runtime PM is left enabled. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: rkisp1: Enable compilation on ARCH_MXCLaurent Pinchart
The ISP used by the Rockchip RK3399 is also found in the NXP i.MX8MP. Enable compilation of the driver for the MXC architecture in addition to ARCH_ROCKCHIP. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-17media: mc-entity: Add a new helper function to get a remote pad for a padLaurent Pinchart
The newly added media_entity_remote_source_pad_unique() helper function handles use cases where the entity has a link enabled uniqueness constraint covering all pads. There are use cases where the constraint covers a specific pad only. Add a new media_pad_remote_pad_unique() function to handle this. It operates as media_entity_remote_source_pad_unique(), but on a given pad instead of on the entity. 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>
2022-07-17media: mc-entity: Add a new helper function to get a remote padLaurent Pinchart
The media_entity_remote_pad_first() helper function returns the first remote pad it finds connected to a given pad. Beside being possibly non-deterministic (as it stops at the first enabled link), the fact that it returns the first match makes it unsuitable for drivers that need to guarantee that a single link is enabled, for instance when an entity can process data from one of multiple sources at a time. For those use cases, add a new helper function, media_entity_remote_pad_unique(), that operates on an entity and returns a remote pad, with a guarantee that only one link is enabled. To ease its use in drivers, also add an inline wrapper that locates source pads specifically. A wrapper that locates sink pads can easily be added when needed. 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>
2022-07-17media: mc-entity: Rename media_entity_remote_pad() to ↵Laurent Pinchart
media_pad_remote_pad_first() The media_entity_remote_pad() is misnamed, as it operates on a pad and not an entity. Rename it to media_pad_remote_pad_first() to clarify its behaviour. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-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>