aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging
AgeCommit message (Collapse)Author
2022-12-13Merge tag 'net-next-6.2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next Pull networking updates from Paolo Abeni: "Core: - Allow live renaming when an interface is up - Add retpoline wrappers for tc, improving considerably the performances of complex queue discipline configurations - Add inet drop monitor support - A few GRO performance improvements - Add infrastructure for atomic dev stats, addressing long standing data races - De-duplicate common code between OVS and conntrack offloading infrastructure - A bunch of UBSAN_BOUNDS/FORTIFY_SOURCE improvements - Netfilter: introduce packet parser for tunneled packets - Replace IPVS timer-based estimators with kthreads to scale up the workload with the number of available CPUs - Add the helper support for connection-tracking OVS offload BPF: - Support for user defined BPF objects: the use case is to allocate own objects, build own object hierarchies and use the building blocks to build own data structures flexibly, for example, linked lists in BPF - Make cgroup local storage available to non-cgroup attached BPF programs - Avoid unnecessary deadlock detection and failures wrt BPF task storage helpers - A relevant bunch of BPF verifier fixes and improvements - Veristat tool improvements to support custom filtering, sorting, and replay of results - Add LLVM disassembler as default library for dumping JITed code - Lots of new BPF documentation for various BPF maps - Add bpf_rcu_read_{,un}lock() support for sleepable programs - Add RCU grace period chaining to BPF to wait for the completion of access from both sleepable and non-sleepable BPF programs - Add support storing struct task_struct objects as kptrs in maps - Improve helper UAPI by explicitly defining BPF_FUNC_xxx integer values - Add libbpf *_opts API-variants for bpf_*_get_fd_by_id() functions Protocols: - TCP: implement Protective Load Balancing across switch links - TCP: allow dynamically disabling TCP-MD5 static key, reverting back to fast[er]-path - UDP: Introduce optional per-netns hash lookup table - IPv6: simplify and cleanup sockets disposal - Netlink: support different type policies for each generic netlink operation - MPTCP: add MSG_FASTOPEN and FastOpen listener side support - MPTCP: add netlink notification support for listener sockets events - SCTP: add VRF support, allowing sctp sockets binding to VRF devices - Add bridging MAC Authentication Bypass (MAB) support - Extensions for Ethernet VPN bridging implementation to better support multicast scenarios - More work for Wi-Fi 7 support, comprising conversion of all the existing drivers to internal TX queue usage - IPSec: introduce a new offload type (packet offload) allowing complete header processing and crypto offloading - IPSec: extended ack support for more descriptive XFRM error reporting - RXRPC: increase SACK table size and move processing into a per-local endpoint kernel thread, reducing considerably the required locking - IEEE 802154: synchronous send frame and extended filtering support, initial support for scanning available 15.4 networks - Tun: bump the link speed from 10Mbps to 10Gbps - Tun/VirtioNet: implement UDP segmentation offload support Driver API: - PHY/SFP: improve power level switching between standard level 1 and the higher power levels - New API for netdev <-> devlink_port linkage - PTP: convert existing drivers to new frequency adjustment implementation - DSA: add support for rx offloading - Autoload DSA tagging driver when dynamically changing protocol - Add new PCP and APPTRUST attributes to Data Center Bridging - Add configuration support for 800Gbps link speed - Add devlink port function attribute to enable/disable RoCE and migratable - Extend devlink-rate to support strict prioriry and weighted fair queuing - Add devlink support to directly reading from region memory - New device tree helper to fetch MAC address from nvmem - New big TCP helper to simplify temporary header stripping New hardware / drivers: - Ethernet: - Marvel Octeon CNF95N and CN10KB Ethernet Switches - Marvel Prestera AC5X Ethernet Switch - WangXun 10 Gigabit NIC - Motorcomm yt8521 Gigabit Ethernet - Microchip ksz9563 Gigabit Ethernet Switch - Microsoft Azure Network Adapter - Linux Automation 10Base-T1L adapter - PHY: - Aquantia AQR112 and AQR412 - Motorcomm YT8531S - PTP: - Orolia ART-CARD - WiFi: - MediaTek Wi-Fi 7 (802.11be) devices - RealTek rtw8821cu, rtw8822bu, rtw8822cu and rtw8723du USB devices - Bluetooth: - Broadcom BCM4377/4378/4387 Bluetooth chipsets - Realtek RTL8852BE and RTL8723DS - Cypress.CYW4373A0 WiFi + Bluetooth combo device Drivers: - CAN: - gs_usb: bus error reporting support - kvaser_usb: listen only and bus error reporting support - Ethernet NICs: - Intel (100G): - extend action skbedit to RX queue mapping - implement devlink-rate support - support direct read from memory - nVidia/Mellanox (mlx5): - SW steering improvements, increasing rules update rate - Support for enhanced events compression - extend H/W offload packet manipulation capabilities - implement IPSec packet offload mode - nVidia/Mellanox (mlx4): - better big TCP support - Netronome Ethernet NICs (nfp): - IPsec offload support - add support for multicast filter - Broadcom: - RSS and PTP support improvements - AMD/SolarFlare: - netlink extened ack improvements - add basic flower matches to offload, and related stats - Virtual NICs: - ibmvnic: introduce affinity hint support - small / embedded: - FreeScale fec: add initial XDP support - Marvel mv643xx_eth: support MII/GMII/RGMII modes for Kirkwood - TI am65-cpsw: add suspend/resume support - Mediatek MT7986: add RX wireless wthernet dispatch support - Realtek 8169: enable GRO software interrupt coalescing per default - Ethernet high-speed switches: - Microchip (sparx5): - add support for Sparx5 TC/flower H/W offload via VCAP - Mellanox mlxsw: - add 802.1X and MAC Authentication Bypass offload support - add ip6gre support - Embedded Ethernet switches: - Mediatek (mtk_eth_soc): - improve PCS implementation, add DSA untag support - enable flow offload support - Renesas: - add rswitch R-Car Gen4 gPTP support - Microchip (lan966x): - add full XDP support - add TC H/W offload via VCAP - enable PTP on bridge interfaces - Microchip (ksz8): - add MTU support for KSZ8 series - Qualcomm 802.11ax WiFi (ath11k): - support configuring channel dwell time during scan - MediaTek WiFi (mt76): - enable Wireless Ethernet Dispatch (WED) offload support - add ack signal support - enable coredump support - remain_on_channel support - Intel WiFi (iwlwifi): - enable Wi-Fi 7 Extremely High Throughput (EHT) PHY capabilities - 320 MHz channels support - RealTek WiFi (rtw89): - new dynamic header firmware format support - wake-over-WLAN support" * tag 'net-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2002 commits) ipvs: fix type warning in do_div() on 32 bit net: lan966x: Remove a useless test in lan966x_ptp_add_trap() net: ipa: add IPA v4.7 support dt-bindings: net: qcom,ipa: Add SM6350 compatible bnxt: Use generic HBH removal helper in tx path IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver selftests: forwarding: Add bridge MDB test selftests: forwarding: Rename bridge_mdb test bridge: mcast: Support replacement of MDB port group entries bridge: mcast: Allow user space to specify MDB entry routing protocol bridge: mcast: Allow user space to add (*, G) with a source list and filter mode bridge: mcast: Add support for (*, G) with a source list and filter mode bridge: mcast: Avoid arming group timer when (S, G) corresponds to a source bridge: mcast: Add a flag for user installed source entries bridge: mcast: Expose __br_multicast_del_group_src() bridge: mcast: Expose br_multicast_new_group_src() bridge: mcast: Add a centralized error path bridge: mcast: Place netlink policy before validation functions bridge: mcast: Split (*, G) and (S, G) addition into different functions bridge: mcast: Do not derive entry type from its filter mode ...
2022-12-13Merge tag 'drm-next-2022-12-13' of git://anongit.freedesktop.org/drm/drmLinus Torvalds
Pull drm updates from Dave Airlie: "The biggest highlight is that the accel subsystem framework is merged. Hopefully for 6.3 we will be able to line up a driver to use it. In drivers land, i915 enables DG2 support by default now, and nouveau has a big stability refactoring and initial ampere support, AMD includes new hw IP support and should build on ARM again. There is also an ofdrm driver to take over offb on platforms it's used. Stuff outside my tree, the dma-buf patches hit a few places, the vc4 firmware changes also do, and i915 has some interactions with MEI for discrete GPUs. I think all of those should have been acked/reviewed by relevant parties. New driver: - ofdrm - replacement for offb fbdev: - add support for nomodeset fourcc: - add Vivante tiled modifier core: - atomic-helpers: CRTC primary plane test fixes, fb access hooks - connector: TV API consistency, cmdline parser improvements - send connector hotplug on cleanup - sort makefile objects tests: - sort kunit tests - improve DP-MST tests - add kunit helpers to create a device sched: - module param for scheduling policy - refcounting fix buddy: - add back random seed log ttm: - convert ttm_resource to size_t - optimize pool allocations edid: - HFVSDB parsing support fixes - logging/debug improvements - DSC quirks dma-buf: - Add unlocked vmap and attachment mapping - move drivers to common locking convention - locking improvements firmware: - new API for rPI firmware and vc4 xilinx: - zynqmp: displayport bridge support - dpsub fix bridge: - adv7533: Remove dynamic lane switching - it6505: Runtime PM support, sync improvements - ps8640: Handle AUX defer messages - tc358775: Drop soft-reset over I2C panel: - panel-edp: Add INX N116BGE-EA2 C2 and C4 support. - Jadard JD9365DA-H3 - NewVision NV3051D amdgpu: - DCN support on ARM - DCN 2.1 secure display - Sienna Cichlid mode2 reset fixes - new GC 11.x firmware versions - drop AMD specific DSC workarounds in favour of drm code - clang warning fixes - scheduler rework - SR-IOV fixes - GPUVM locking fixes - fix memory leak in CS IOCTL error path - flexible array updates - enable new GC/PSP/SMU/NBIO IP - GFX preemption support for gfx9 amdkfd: - cache size fixes - userptr fixes - enable cooperative launch on gfx 10.3 - enable GC 11.0.4 KFD support radeon: - replace kmap with kmap_local_page - ACPI ref count fix - HDA audio notifier support i915: - DG2 enabled by default - MTL enablement work - hotplug refactoring - VBT improvements - Display and watermark refactoring - ADL-P workaround - temp disable runtime_pm for discrete- - fix for A380 as a secondary GPU - Wa_18017747507 for DG2 - CS timestamp support fixes for gen5 and earlier - never purge busy TTM objects - use i915_sg_dma_sizes for all backends - demote GuC kernel contexts to normal priority - gvt: refactor for new MDEV interface - enable DC power states on eDP ports - fix gen 2/3 workarounds nouveau: - fix page fault handling - Ampere acceleration support - driver stability improvements - nva3 backlight support msm: - MSM_INFO_GET_FLAGS support - DPU: XR30 and P010 image formats - Qualcomm SM6115 support - DSI PHY support for QCM2290 - HDMI: refactored dev init path - remove exclusive-fence hack - fix speed-bin detection - enable clamp to idle on 7c3 - improved hangcheck detection vmwgfx: - fb and cursor refactoring - convert to generic hashtable - cursor improvements etnaviv: - hw workarounds - softpin MMU fixes ast: - atomic gamma LUT support - convert to SHMEM lcdif: - support YUV planes - Increase DMA burst size - FIFO threshold tuning meson: - fix return type of cvbs mode_valid mgag200: - fix PLL setup on some revisions sun4i: - A100 and D1 support udl: - modesetting improvements - hot unplug support vc4: - support PAL-M - fix regression preventing 4K @ 60Hz - fix NULL ptr deref v3d: - switch to drm managed resources renesas: - RZ/G2L DSI support - DU Kconfig cleanup mediatek: - fixup dpi and hdmi - MT8188 dpi support - MT8195 AFBC support tegra: - NVDEC hardware on Tegra234 SoC hdlcd: - switch to drm managed resources ingenic: - fix registration error path hisilicon: - convert to drm_mode_init maildp: - use managed resources mtk: - use drm_mode_init rockchip: - use drm_mode_copy" * tag 'drm-next-2022-12-13' of git://anongit.freedesktop.org/drm/drm: (1397 commits) drm/amdgpu: fix mmhub register base coding error drm/amdgpu: add tmz support for GC IP v11.0.4 drm/amdgpu: enable GFX Clock Gating control for GC IP v11.0.4 drm/amdgpu: enable GFX Power Gating for GC IP v11.0.4 drm/amdgpu: enable GFX IP v11.0.4 CG support drm/amdgpu: Make amdgpu_ring_mux functions as static drm/amdgpu: generally allow over-commit during BO allocation drm/amd/display: fix array index out of bound error in DCN32 DML drm/amd/display: 3.2.215 drm/amd/display: set optimized required for comp buf changes drm/amd/display: Add debug option to skip PSR CRTC disable drm/amd/display: correct DML calc error of UrgentLatency drm/amd/display: correct static_screen_event_mask drm/amd/display: Ensure commit_streams returns the DC return code drm/amd/display: read invalid ddc pin status cause engine busy drm/amd/display: Bypass DET swath fill check for max clocks drm/amd/display: Disable uclk pstate for subvp pipes drm/amd/display: Fix DCN2.1 default DSC clocks drm/amd/display: Enable dp_hdmi21_pcon support drm/amd/display: prevent seamless boot on displays that don't have the preferred dig ...
2022-12-13Merge tag 'media/v6.2-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - DVB core changes to avoid refcount troubles and UAF - DVB API/core has gained support for DVB-C2 and DVB-S2X - New sensor drivers: ov08x40, ov4689.c, st-vgxy61 and tc358746.c - Removal of an unused sensor driver: s5k4ecgx - Move microchip_csi2dc to a new directory, named after the manufacturer - Add media controller support to Microship drivers - Old Atmel/Microship drivers that don't use media controler got moved to staging - New drivers added for Renesas RZ/G2L CRU and MIPI CSI-2 support - Allwinner A31 camera sensor driver code was now split into a bridge and a separate processor driver - Added a virtual stateless decoder driver in order to test core support for stateless drivers and test userspace apps using it - removed platform-based support for ov9650, as this is not used anymore - atomisp now uses videobuf2 and supports normal mmap mode - the imx7-media-csi driver got promoted from staging - rcar-vin driver has gained support for gen3 UDS (Up Down Scaler) - most i2c drivers now use I2C .probe_new() kAPI - lots of drivers fixes, cleanups and improvements * tag 'media/v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (544 commits) media: s5c73m3: Switch to GPIO descriptors media: i2c: s5k5baf: switch to using gpiod API media: i2c: s5k6a3: switch to using gpiod API media: imx: remove code for non-existing config IMX_GPT_ICAP media: si470x: Fix use-after-free in si470x_int_in_callback() media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependencies media: coda: Add check for kmalloc media: coda: Add check for dcoda_iram_alloc dt-bindings: media: s5c73m3: Fix reset-gpio descriptor media: dt-bindings: allwinner: h6-vpu-g2: Add IOMMU reference property media: s5k4ecgx: Delete driver media: s5k4ecgx: Switch to GPIO descriptors media: Switch to use dev_err_probe() helper headers: Remove some left-over license text in include/uapi/linux/v4l2-* headers: Remove some left-over license text in include/uapi/linux/dvb/ media: usb: pwc-uncompress: Use flex array destination for memcpy() media: s5p-mfc: Fix to handle reference queue during finishing media: s5p-mfc: Clear workbit to handle error condition media: s5p-mfc: Fix in register read and write for H264 media: imx: Use get_mbus_config instead of parsing upstream DT endpoints ...
2022-12-12Merge tag 'timers-core-2022-12-10' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer updates from Thomas Gleixner: "Updates for timers, timekeeping and drivers: Core: - The timer_shutdown[_sync]() infrastructure: Tearing down timers can be tedious when there are circular dependencies to other things which need to be torn down. A prime example is timer and workqueue where the timer schedules work and the work arms the timer. What needs to prevented is that pending work which is drained via destroy_workqueue() does not rearm the previously shutdown timer. Nothing in that shutdown sequence relies on the timer being functional. The conclusion was that the semantics of timer_shutdown_sync() should be: - timer is not enqueued - timer callback is not running - timer cannot be rearmed Preventing the rearming of shutdown timers is done by discarding rearm attempts silently. A warning for the case that a rearm attempt of a shutdown timer is detected would not be really helpful because it's entirely unclear how it should be acted upon. The only way to address such a case is to add 'if (in_shutdown)' conditionals all over the place. This is error prone and in most cases of teardown not required all. - The real fix for the bluetooth HCI teardown based on timer_shutdown_sync(). A larger scale conversion to timer_shutdown_sync() is work in progress. - Consolidation of VDSO time namespace helper functions - Small fixes for timer and timerqueue Drivers: - Prevent integer overflow on the XGene-1 TVAL register which causes an never ending interrupt storm. - The usual set of new device tree bindings - Small fixes and improvements all over the place" * tag 'timers-core-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (34 commits) dt-bindings: timer: renesas,cmt: Add r8a779g0 CMT support dt-bindings: timer: renesas,tmu: Add r8a779g0 support clocksource/drivers/arm_arch_timer: Use kstrtobool() instead of strtobool() clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() clocksource/drivers/timer-ti-dm: Clear settings on probe and free clocksource/drivers/timer-ti-dm: Make timer_get_irq static clocksource/drivers/timer-ti-dm: Fix warning for omap_timer_match clocksource/drivers/arm_arch_timer: Fix XGene-1 TVAL register math error clocksource/drivers/timer-npcm7xx: Enable timer 1 clock before use dt-bindings: timer: nuvoton,npcm7xx-timer: Allow specifying all clocks dt-bindings: timer: rockchip: Add rockchip,rk3128-timer clockevents: Repair kernel-doc for clockevent_delta2ns() clocksource/drivers/ingenic-ost: Define pm functions properly in platform_driver struct clocksource/drivers/sh_cmt: Access registers according to spec vdso/timens: Refactor copy-pasted find_timens_vvar_page() helper into one copy Bluetooth: hci_qca: Fix the teardown problem for real timers: Update the documentation to reflect on the new timer_shutdown() API timers: Provide timer_shutdown[_sync]() timers: Add shutdown mechanism to the internal functions timers: Split [try_to_]del_timer[_sync]() to prepare for shutdown mode ...
2022-12-12Merge tag 'soc-dt-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/socLinus Torvalds
Pull ARM SoC DT updates from Arnd Bergmann: "The devicetree changes contain exactly 1000 non-merge changesets, including a number of new arm64 SoC variants from Qualcomm and Apple, as well as the Renesas r9a07g043f/u chip in both arm64 and riscv variants. While we have occasionally merged support for non-arm SoCs in the past, this is now the normal path for riscv devicetree files. The most notable changes, by SoC platform, are: - The Apple T6000 (M1 Pro), T6001 (M1 Max) and T6002 (M1 Ultra) chips now have initial support. This is particularly nice as I am typing this on a T6002 Mac Studio with only a small number of driver patches. - Qualcomm MSM8996 Pro (Snapdragon 821), SM6115 (Snapdragon 662), SM4250 (Snapdragon 460), SM6375 (Snapdragon 695), SDM670 (Snapdragon 670), MSM8976 (Snapdragon 652) and MSM8956 (Snapdragon 650) are all mobile phone chips that are closely related to others we already support. Adding those helps support more phones and we add several models from Sony (Xperia 10 IV, 5 IV, X, and X compact), OnePlus (One, 3, 3T, and Nord N100), Xiaomi (Poco F1, Mi6), Huawei (Watch) and Google (Pixel 3a). There are also new variants of the Herobrine and Trogdor chromebook motherboards. SA8540P is an automotive SoC used in the Qdrive-3 development platform - Rockchips gains no new SoC variants, but a lot of new boards: three mobile gaming systems based on RK3326 Odroid-Go/rg351 family, two more Anbernic gaming systems based on RK3566 and a number of other RK356x based single-board computers. - Renesas RZ/G2UL (r9a07g043) was already supported for arm64, but as the newly added RZ/Five is based on the same design, this now gets reorganized in order to share most of the dts description between the two and add the RZ/Five SMARC EVK board support. Aside from that, there are the usual changes all over the tree: - New boards on other platforms contain two ASpeed BMC users, two Broadcom based Wifi routers, Zyxel NSA310S NAS, the i.MX6 based Kobo Aura2 ebook reader, two i.MX8 based development boards, two Uniphier Pro5 development boards, the STM32MP1 testbench board from DHCOR, the TI K3 based BeagleBone AI-64 board, and the Mediatek Helio X10 based Sony Xperia M5 phone. - The Starfive JH7100 source gets reorganized in order to support the VisionFive V1 board. - Minor updates and cleanups for Intel SoCFPGA, Marvell PXA168, TI, ST, NXP, Apple, Broadcom, Juno, Marvell MVEBU, at91, nuvoton, Tegra, Mediatek, Renesas, Hisilicon, Allwinner, Samsung, ux500, spear, ... The treewide cleanups now have a lot of fixes for cache nodes and other binding violoations. - Somewhat larger sets of reworks for NVIDIA Tegra, Qualcomm and Renesas platforms, adding a lot more on-chip device support - A rework of the way that DTB overlays are built" * tag 'soc-dt-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (979 commits) arm64: dts: apple: t6002: Fix GPU power domains arm64: dts: apple: t600x-pmgr: Fix search & replace typo arm64: dts: apple: Add t8103 L1/L2 cache properties and nodes arm64: dts: apple: Rename dart-sio* to sio-dart* arch: arm64: apple: t600x: Use standard "iommu" node name arch: arm64: apple: t8103: Use standard "iommu" node name ARM: dts: socfpga: Fix pca9548 i2c-mux node name dt-bindings: iio: adc: qcom,spmi-vadc: fix PM8350 define dt-bindings: iio: adc: qcom,spmi-vadc: extend example arm64: dts: qcom: sc8280xp: fix UFS DMA coherency arm64: dts: qcom: sc7280: Add DT for sc7280-herobrine-zombie arm64: dts: qcom: sm8250-sony-xperia-edo: fix no-mmc property for SDHCI arm64: dts: qcom: sdm845-sony-xperia-tama: fix no-mmc property for SDHCI arm64: dts: qcom: sda660-inforce-ifc6560: fix no-mmc property for SDHCI arm64: dts: qcom: sa8155p-adp: fix no-mmc property for SDHCI arm64: dts: qcom: qrb5165-rb: fix no-mmc property for SDHCI arm64: dts: qcom: sm8450: align MMC node names with dtschema arm64: dts: qcom: sc7180-trogdor: use generic node names arm64: dts: qcom: sm8450-hdk: add sound support arm64: dts: qcom: sm8450: add Soundwire and LPASS ...
2022-12-07media: imx: remove code for non-existing config IMX_GPT_ICAPLukas Bulwahn
There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-12-07media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependenciesGeert Uytterhoeven
By moving support for the USB Syntek DC1125 Camera to staging, the dependencies on MEDIA_USB_SUPPORT and MEDIA_CAMERA_SUPPORT were lost. Fixes: 56280c64ecac ("media: stkwebcam: deprecate driver, move to staging") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-12-07media: imx: Use get_mbus_config instead of parsing upstream DT endpointsPhilipp Zabel
Stop parsing upstream neighbors' device-tree endpoints to retrieve the media bus configuration. Instead use the get_mbus_config op and throw an error if the upstream subdevice does not implement it. Also drop the corresponding TODO entry and the now unused imx_media_get_pad_fwnode() function. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-12-07drivers: staging: media: omap4iss: Use BIT macro instead of left shiftingMoses Christopher Bollavarapu
There is a BIT(nr) macro available in Linux Kernel, which does the same thing. Example: 1 << 7 is same as BIT(7) Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-11-29Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
tools/lib/bpf/ringbuf.c 927cbb478adf ("libbpf: Handle size overflow for ringbuf mmap") b486d19a0ab0 ("libbpf: checkpatch: Fixed code alignments in ringbuf.c") https://lore.kernel.org/all/20221121122707.44d1446a@canb.auug.org.au/ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-25media: staging: omap4iss: remove cacheflush importIan Cowan
The cacheflush import is never used, so it is safe to remove it as an import. Signed-off-by: Ian Cowan <ian@linux.cowan.aero> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: Unstage the imx7-media-csi driverLaurent Pinchart
The imx7-media-csi driver, currently in staging, is ready for prime-time. The staging TODO file lists a few items specific to that driver, that are already addressed (the "all of the above" part) or can be addressed later: - The frame interval monitoring support is a software mechanism to monitor the device for unexpected stalls, and should be part of the V4L2 core if desired. - Restricting the support media bus formats based on the SoC integration only aims at reducing userspace confusion by not enumerating options that are known not to be possible, it won't cause regressions if handled later. Move the description of the media bus format restriction TODO item to the driver, drop the other TODO items, and move the driver out of staging. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csiLaurent Pinchart
The imx8mq-mipi-csi2 driver targets SoCs that also run the imx7-media-csi driver, but they are distinct. Decouple them in Kconfig to prepare for destaging of the imx7-media-csi driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formatsLaurent Pinchart
Commit 9babbbaaeb87 ("media: imx: imx7-media-csi: Use dual sampling for YUV 1X16") set BIT_MIPI_DOUBLE_CMPNT in the CR18 register for 16-bit YUV formats in imx7_csi_configure(). The CR18 register is always updated with read-modify-write cycles, so if a 16-bit YUV format is selected, the bit will stay set forever, even if the format is changed. Fix it by clearing the bit at the beginning of the imx7_csi_configure() function. While at it, swap two of the bits being cleared to match the MSB to LSB order. This doesn't cause any functional change. Fixes: 9babbbaaeb87 ("media: imx: imx7-media-csi: Use dual sampling for YUV 1X16") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: imx7-media-csi: Rename phys variables to dma_addrLaurent Pinchart
All the phys variables and structure fields store a DMA address, not a physical address. Even if the two are effectively identical on all platforms where this driver is used due to the lack of IOMMU, rename the variables to dma_addr to make their usage clearer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: imx7-media-csi: Move variable to loop scopeLaurent Pinchart
The phys variable is only used as a local loop variable in imx7_csi_setup_vb2_buf(), with each entry in the array being used in the corresponding iteration of the loop only. Move it to loop scope, simplifying the array to a single variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: imx7-media-csi: Add support for fast-tracking queued buffersPaul Elder
The CSI hardware compatible with this driver handles buffers using a ping-pong mechanism with two sets of destination addresses. Normally, when an interrupt comes in to signal the completion of one buffer, say FB1, it assigns the next buffer in the queue to the next FB1, and the hardware starts to capture into FB2 in the meantime. In a buffer underrun situation, in the above example without loss of generality, if a new buffer is queued before the interrupt for FB1 comes in, we can program the buffer into FB2 (which is programmed with a dummy buffer, as there is a buffer underrun). This of course races with the interrupt that signals FB1 completion, as once that interrupt comes in, we are no longer guaranteed that the programming of FB2 was in time and must assume it was too late. This race is resolved partly by locking the programming of FB2. If it came after the interrupt for FB1, then the variable that is used to determine which FB to program would have been swapped by the interrupt handler. This alone isn't sufficient, however, because the interrupt could still be generated (thus the hardware starts capturing into the other fb) while the fast-tracking routine has the irq lock. Thus, after programming the fb register to fast-track the buffer, the isr also must be checked to confirm that an interrupt didn't come in the meantime. If it has, we must assume that programming the register for the fast-tracked buffer was not in time, and queue the buffer normally. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: imx: imx7-media-csi: Remove a useless includeChristophe JAILLET
<linux/gcd.h> is not needed for this driver. Remove the corresponding #include. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp: Make bds_factors_list be type of struct u32_fractAndy Shevchenko
The list contains the Bayer scale index, and rational fraction of it. The struct u32_fract is suitable type to hold that. Convert the driver to use latter instead of former. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp_ov2680: Fix 1280x720 -> 1296x736 resolutionHans de Goede
The ov2680_720p_30fps register init list used for the 1296x736 resolution sets the hsize register to 1296 and the vsize register to 736. This is actually the right thing to do when combined with the atomISP2 because the ISP requires 16 bytes padding leaving userspace to see 1280x720. But the resolution list entries for this was incorrectly reporting the resolution being send to the ISP as already being 1280x720, leaving usespace to see 1274x704 as resolution. Worse then userspace seeing a weird resolution selecting the 1280x720 sensor resolution (which in reality is sending 1296x736) to the ISP was causing the ISP to hang on Cherry Trail based tablets (Bay Trail works fine for some reason). This commit also adds a bunch of comments annotating what the various register writes the init lists are doing. 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>
2022-11-25media: atomisp: Remove atomisp_ospm_dphy_up()/_down() functionsHans de Goede
atomisp_ospm_dphy_up() is an empty function now and atomisp_ospm_dphy_down() contains a couple of checks + goto done statements which don't matter since the function always ends up at the done label regardless and then it does 1 pci-config write. Move the single pci-config write directly to atomisp_power_off() and remove the atomisp_ospm_dphy_up()/_down() functions. 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>
2022-11-25media: atomisp: Remove atomisp_ospm_dphy_down() call from probe error pathHans de Goede
The only thing which atomisp_ospm_dphy_down() does is disable the CSI pins, but if we failed to probe the ISP then these will never have been enabled (because the ISP never started streaming). So the atomisp_ospm_dphy_down() call in the probe error path is unnecessary, remove it. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp: Move calling of css_[un]init() to power_on()/_off()Hans de Goede
atomisp_css_init() is always called after calling atomisp_power_on() either directly or through getting a runtime-pm reference. Likewise atomisp_css_uninit() is always called after calling atomisp_power_off(). Move the call site of these 2 functions to inside atomisp_power_on() / atomisp_power_off() to make this more explicit. Note this makes atomisp_reset() also set isp_fatal_error on atomisp_power_on() errors, where as before it only did this on atomisp_css_init() errors. This behavior change is for the better, since power-on failing is pretty fatal too. 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>
2022-11-25media: atomisp: Remove duplication between runtime-pm and normal-pm codeHans de Goede
atomisp_suspend() contains a 1:1 copy of atomisp_runtime_suspend() and the same goes for the resume() functions. Rename the runtime functions to atomisp_power_on()/_off() and use these as runtime-pm handlers as well as helper in other places to remove the code duplication. 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>
2022-11-25media: atomisp: Remove sw_contex.power_state checksHans de Goede
Remove the unnecessary sw_contex.power_state checks: 1. atomisp_freq_scaling() and atomisp_stop_streaming() only run when the ISP is powered up through runtime-pm, so the checks are not necessary 2. atomisp_mrfld_pre_power_down() and atomisp_runtime_resume() are only called through the driver-core pm handling code which already guarantees they are not called when already powered down / up. 3. atomisp_isr() also checks isp->css_initialized which only gets set by atomisp_css_init() which runs *after* powering up the ISP and which gets cleared by atomisp_css_uninit() *before* powering down the ISP. So all the checks are unnecessary, remove them as well as the sw_contex.power_state field itself. 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>
2022-11-25media: atomisp: Remove atomisp_css_suspend()/_resume()Hans de Goede
atomisp_css_suspend() is a 1:1 copy of atomisp_css_uninit() and atomisp_css_resume() is a 1:1 copy of atomisp_css_init(). Remove the 2 copies and have their one caller just call atomisp_css_uninit() / atomisp_css_init() instead. 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>
2022-11-25media: atomisp: Remove clearing of config from atomisp_css_uninit()Hans de Goede
atomisp_css_uninit() only runs when all streams are stopped and atomisp_css_stop() already clears the config, so the clearing of the config can be dropped from atomisp_css_uninit(). 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>
2022-11-25media: atomisp: Remove atomisp_mrfld_power_down()/_up()Hans de Goede
atomisp_mrfld_power_down()/_up() are unnecessary wrappers around atomisp_mrfld_power() remove them and just call atomisp_mrfld_power() directly. 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>
2022-11-25media: atomisp: Remove double atomisp_mrfld_power_down()/_up() calls from ↵Hans de Goede
atomisp_reset() atomisp_reset() calls atomisp_mrfld_power_down() after calling atomisp_runtime_suspend(), which already calls atomisp_mrfld_power_down() itself. And the some goes for atomisp_runtime_resume() / atomisp_mrfld_power_up(). 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>
2022-11-25media: atomisp: Drop userptr support from hmmHans de Goede
After the conversion to videobuf2 userptr support is no longer needed, drop it. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp: Remove unused ia_css_frame_*() functionsHans de Goede
After the conversion to videobuf2 a bunch of ia_css_frame_*() functions are unused, remove them. 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>
2022-11-25media: atomisp: Remove atomisp_css_yuvpp_configure_viewfinder() functionHans de Goede
Remove atomisp_css_yuvpp_configure_viewfinder(), it is not used anywhere. 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>
2022-11-25media: atomisp: Remove 2 unused accelerator mode related functionsHans de Goede
Remove ia_css_pipe_get_acc_stage_desc() and sh_css_flush(), after removing the accelerator /dev/video# node and related ioctls these are no longer used. 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>
2022-11-25media: atomisp: Fix deadlock when the /dev/video# node is closed while still ↵Hans de Goede
streaming atomisp_release() was taking pipe->vb_queue_mutex + isp->mutex at the same time. But if the /dev/video# node is closed while still streaming then vb2_queue_release() will call atomisp_stop_streaming() which takes isp->mutex itself, leading to a deadlock. To fix this only take isp->mutex after cleaning up the v4l2_fh / the vb2_queue. While at it switch to vb2_fop_release() which will take pipe->vb_queue_mutex for us, which also resolves a FIXME comment. 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>
2022-11-25media: atomisp: Log an error on failing to alloc private-memHans de Goede
I managed to trigger an atomisp_css_start() error by pushing my test system towards an OOM situation, this resulted in the following errors: atomisp-isp2 0000:00:03.0: alloc pages err... atomisp-isp2 0000:00:03.0: hmm_bo_alloc_pages failed. atomisp-isp2 0000:00:03.0: stream[0] start error. But it is not entirely clear what the root cause of the "alloc pages err..." error is. I suspect the root cause is alloc_pages_bulk_array() failing. Add a log message to make the root cause more clear if this is hit again. 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>
2022-11-25media: atomisp: Flush queue on atomisp_css_start() errorHans de Goede
I managed to trigger an atomisp_css_start() error by pushing my test system towards an OOM situation, this triggered the following WARN_ON() in __vb2_queue_cancel() in videobuf2-core.c: /* * If you see this warning, then the driver isn't cleaning up properly * after a failed start_streaming(). See the start_streaming() * documentation in videobuf2-core.h for more information how buffers * should be returned to vb2 in start_streaming(). */ if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { Fix this by calling atomisp_flush_video_pipe() to return any queued buffers back to the videobuf2-core on an atomisp_css_start() error. 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>
2022-11-25media: atomisp: Remove unused QOS defines / structure memberHans de Goede
With the accel code gone this is unused, remove it. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp: Remove accelerator pipe creation codeHans de Goede
The ATOMISP_ACC_* custom ioctls and the ACC device node have been removed in commit a5c17adbadcb ("media: atomisp: Remove the ACC device node"). This means that pipe_configs[pipe_id].acc_extension now never gets set which causes atomisp_compat_css20.c: __create_pipe() to always skip creation of pipes with a pipe_id of IA_CSS_PIPE_ID_ACC / a mode of IA_CSS_PIPE_MODE_ACC. This allows removing of the acc_pipe creation / handling code from mainly sh_css.c and a bunch of other places. 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>
2022-11-25media: atomisp: Silence: 'atomisp_q_one_s3a_buffer: drop one s3a stat which ↵Hans de Goede
has exp_id xx' log messages Standard v4l2 userspace apps do not consume the s3a statistics block data. Until we have a userspace consumer for this (libcamera), which might also involve changing the API for this, lower the log level of these messages to dev_dbg() to avoid them filling up the logs. 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>
2022-11-25media: atomisp: gc0310: Power on sensor from set_fmt() callbackHans de Goede
Depending on which order userspace makes various v4l2 calls, the sensor might still be powered down when set_fmt is called. What should really happen here is delay the writing of the mode-related registers till streaming is started, but for now use the same quick fix as the atomisp_ov2680 code and call power_up() from set_fmt() in combination with keeping track of the power-state to avoid doing the power-up sequence twice. 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>
2022-11-25media: atomisp: Remove __atomisp_get_pipe() helperHans de Goede
Remove the complicated __atomisp_get_pipe() helper, atomisp_buf_done() only needs the pipe pointer in cases where it has a frame, so we can simply get the pipe from the frame using the vb_to_pipe() helper. 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>
2022-11-25media: atomisp: Make atomisp_g_fmt_cap() default to YUV420Hans de Goede
Make atomisp_g_fmt_cap() default to YUV420 so that it matches with what atomisp_try_fmt_cap() and atomisp_queue_setup() do when they need to pick a default pixelformat. 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>
2022-11-25media: atomisp: Fix atomisp_try_fmt_cap() always returning YUV420 pixelformatHans de Goede
The atomisp_try_fmt() call in atomisp_try_fmt_cap() replaces the pixelformat passed by userspace with the sensors native pixelformat. Which always gets replaced by V4L2_PIX_FMT_YUV420 by atomisp_adjust_fmt() because raw sensor formats are not supported. This needs to be fixed so that userspace which does a try_fmt call before s_fmt does not end up always getting YUV420 even if it passed something else into the try_fmt call. To fix this restore the userspace requested pixelformat before the atomisp_adjust_fmt() call. atomisp_adjust_fmt() will replace this with V4L2_PIX_FMT_YUV420 in case an unsupported format is requested. Note this relies on the "media: atomisp: Refactor atomisp_adjust_fmt()" change, before that atomisp_adjust_fmt() would return -EINVAL for unsupported pixelformats. 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>
2022-11-25media: atomisp: Refactor atomisp_adjust_fmt()Hans de Goede
Refactor atomisp_adjust_fmt(): 1. The block starting at "format_bridge = atomisp_get_format_bridge(...)" and ending with "if (field == V4L2_FIELD_ANY) field = V4L2_FIELD_NONE;" is duplicated. With only the second block: a) Properly checking that format_bridge is not NULL; amd b) Having the special handling for IA_CSS_FRAME_FORMAT_RAW Remove the first block. 2. On a NULL return from atomisp_get_format_bridge(f->fmt.pix.pixelformat) fall back to V4L2_PIX_FMT_YUV420 just like in the IA_CSS_FRAME_FORMAT_RAW case. atomisp_adjust_fmt() is used in VIDIOC_TRY_FMT handling and that should jusy pick a fmt rather then returning -EINVAL. 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>
2022-11-25media: atomisp: Fix VIDIOC_REQBUFS failing when VIDIOC_S_FMT has not been ↵Hans de Goede
called yet camorama calls VIDIOC_REQBUFS(V4L2_MEMORY_MMAP) to test if MMAP support works (this was added specifically because of the previously broken MMAP support in atomisp). Currently this fails because atomisp_get_css_frame_info() fails in this case. Although it is weird to call VIDIOC_REQBUFS before VIDIOC_S_FMT, it is allowed to do this. Fix this not working by doing a S_FMT to V4L2_PIX_FMT_YUV420 + the highest supported resolution. Note this will cause camorama to use mmap mode, which means it will also use libv4l2 to do format conversion. libv4l2 will pick V4L2_PIX_FMT_RGB565 as input format and this will lead to a garbled video display. This is a libv4lconvert bug, the RGB565 -> RGB24 path in libv4lconvert assumes that stride == width which is not true on the atomisp. I've already send out a libv4lconvert fix for this. Also this can be worked around by passing --dont-use-libv4l2 as argument to camorama. Link: https://git.linuxtv.org/v4l-utils.git/commit/?id=aecfcfccfc2f78d7531456ffa5465666c6bc641e 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>
2022-11-25media: atomisp: Make it possible to call atomisp_set_fmt() without a file handleHans de Goede
To fix atomisp_queue_setup() sometimes failing it needs to be able to call atomisp_set_fmt(), but atomisp_queue_setup() (VIDIOC_REQBUFS) does not get passed a file handle by the videobuf2 core. Partly revert commit b3be98f984d4 ("media: atomisp: Remove a couple of not useful function wrappers") so that atomisp_set_fmt() can be used without a file handle. 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>
2022-11-25media: atomisp: Convert to videobuf2Hans de Goede
Convert atomisp to use videobuf2. This fixes mmap not working and in general moving over to the more modern videobuf2 is a good plan. 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>
2022-11-25media: atomisp: Add ia_css_frame_get_info() helperHans de Goede
Several places rely on the [frame_]info member being the first member of struct ia_css_frame, so that &frame->info will yield NULL when frame is NULL (some places already explicitly check for a NULL frame pointer but not nearly all). For videobuf2 support the vb2_v4l2_buffer struct needs to be embedded in the frame struct and it needs to be the first member. Breaking the assumption that &frame->info will yield NULL when frame is NULL. Add a ia_css_frame_get_info() helper to return either the ia_css_frame_info struct embedded in the frame, or NULL when the frame pointer is NULL and use this in places where a ia_css_frame_info ptr or NULL is expected. To make sure that we catch all uses of the info field this patch also renames the info field to frame_info. This is a preparation patch for converting the driver to videobuf2. 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>
2022-11-25media: atomisp: Use new atomisp_flush_video_pipe() helper in atomisp_streamoff()Hans de Goede
Use the new atomisp_flush_video_pipe() helper instead of open-coding it. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-11-25media: atomisp: Add an index helper variable to atomisp_buf_done()Hans de Goede
With the videobuf2 conversion accessing the index of a frame is going to become more involved and writing this out each time is undesired. Add an 'i' helper variable for the index and assing this once as preparation for the videobuf2 conversion. This also makes use of the new rules wrt max line-lengths in the kernel to avoid breaking up a bunch of lines. Not breaking these lines results in better readable code (IMHO). 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>