Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2700286rdh; Mon, 30 Oct 2023 05:25:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgrf/NU+DCK/ab4H0dG9/pvALF8moyNHa1iDN90syP71V3HiMEjD7aHY6ivrqffGTbtBwb X-Received: by 2002:a05:6e02:1c43:b0:357:a0a0:638d with SMTP id d3-20020a056e021c4300b00357a0a0638dmr12841170ilg.4.1698668727643; Mon, 30 Oct 2023 05:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698668727; cv=none; d=google.com; s=arc-20160816; b=sD+lo4uhKJUgJGV1oLUT/q9zBgmCIMh8aqoZ/YQBaXOpDVKXvQpcP41aiWr7wJa1GV Lw227rfvyP9M7TKcglJAvqSgLxJcIm8dOFH0y94OEeBRMIqyonKBPO/4JcveASmM7s/5 rNqJYd3pHttHNrq0qh8LVCMIEj+GLg0zCnq4AtYu17igeOc3XMG72D0dMOT1Bws/OWsb IdMC7CiL7CJpYSMbT9dopRe9tzfVkZ8PxZrxOw/O47mrSAwS3Bx97v+qNEipZvPwz7hA nVAmPLbTuvrebtV9MfNcNUD4ULshPXLO30MQu12+NzmHCeDR4VIcX1gBVq78tYYb/im2 UWxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TL756I7/PETLnY0aYTdOAX8LZxf/j/VkKi73p1rwwF0=; fh=/sUFM3LIRLscnjlLfpf1Icbv7aS2VHkc5345TYI64Ck=; b=q2tveQKKDLbjswMZwjGbwoscIwot5E8TWtpQQvO7mYTamKQGRhLHZqnsmRO77cljs3 wv7ClV9rsycuZW8q1/NfgQyqQSKtp13QM/m+lYADAk2R3Vs9916W2ENnrllocz6IPrKt 56Aeo4o5mYRUCDCcViU9I6nkb3daSxsq7IbISO+x6wyvtgD7EamRxWkRvXK8xTFH/RyJ 05HPjPtPapQuf9hRB5bMWptmrO2i/nk62aW94aEsTP7HFCWm3PVC58RsaiWYahwa3lxa zbXGg702z8sEyHrjYU9AZtT+0/ggbA6bY4lGbu9f12XJ+6LVmr8fgkRRZvsVrvvOTPQc cu8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="D/ng9NWV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m7-20020a633f07000000b005898699b2afsi5057400pga.176.2023.10.30.05.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 05:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="D/ng9NWV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A53DC80C247B; Mon, 30 Oct 2023 05:25:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233191AbjJ3MZZ (ORCPT + 99 others); Mon, 30 Oct 2023 08:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232531AbjJ3MZY (ORCPT ); Mon, 30 Oct 2023 08:25:24 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC7B93; Mon, 30 Oct 2023 05:25:19 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8D2DAC0006; Mon, 30 Oct 2023 12:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1698668718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TL756I7/PETLnY0aYTdOAX8LZxf/j/VkKi73p1rwwF0=; b=D/ng9NWV5CCbd12SQWHMlBH0Y7K7LHO5AUynjNiVDqrLF/vmGxBCJsJWGSqwkJ4wziux6Y vn1ldUm8njhD+yXAvEXDrhSEOvOXpKrOgVdHBD3WPwG0mEOq6MSTITyfSYwCANL8vkK7Cv HZLutC5KU7w7eiqR8vVEcE58dvSF6AyfODQ40CHzR4qCwCTCNDp/TQbWoLH8/VjLfq8z4M D3O6paEyc49hoBSHptyhCjcmU6XRgJKfi63iFofxAfOWBM+WX/i5G4pdZwLTcCFyMFQsRR 8IVib7vLdASxqGLuzyhHvhVkL94o9q77GcX+qenA5OezxhLbpbPARquX4KtIGw== From: Mehdi Djait To: mchehab@kernel.org, heiko@sntech.de, hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, conor+dt@kernel.org Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, maxime.chevallier@bootlin.com, paul.kocialkowski@bootlin.com, michael.riesch@wolfvision.net, Mehdi Djait Subject: [PATCH v9 0/3] media: rockchip: Add a driver for Rockchip's camera interface Date: Mon, 30 Oct 2023 13:25:11 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: mehdi.djait@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 05:25:26 -0700 (PDT) Hello everyone, V9 for basic support of the Video Input Processor found on the Rockchip PX30 SoC The v6 is based on the v5 of the series introducing the driver: sent 29 Dec 2020 [1] Most of this driver was written following the BSP driver from rockchip, removing the parts that either didn't fit correctly the guidelines, or that couldn't be tested. In the BSP, this driver is known as the "cif" driver, but this was renamed to "vip" to better fit the controller denomination in the datasheet. This version of the driver supports ONLY the parallel interface BT656 and was tested/implemented using an SDTV video decoder media_tree, base-commit: 94e27fbeca27d8c772fc2bc807730aaee5886055 V8 => V9: cif/capture.c cif/dev.c cif/dev.h: as suggested by Paul: - changed the name from "vip" back to "cif" - removed the scratch buffer and added frame dropping - removed mplane, only single plane formats are supported anyway - adjusted the Kconfig - added the match_data to the stream struct - some cosmetics, and error return codes changes as suggested by Michael: - changed the writel and readl helpers to be inline functions and changed the name - fixed typos in the commit message - changed the cif_device struct element "sensor" to "remote" rockchip,rk3066-cif.yaml: - changed the compatible rockchip,px30-vip to rockchip,rk3066-cif: rk3066 is the earliest Rockchip SoC that uses cif and it is the first model starting the RK30 lineup. - changed the node name to video-capture - adjusted the description V7 => V8: vip/capture.c: - fixed a warning: unused variable reported by the kernel test robot V6 => V7: vip/capture.c vip/dev.c vip/dev.h - renamed all struct rk_vip_dev dev => struct rk_vip_dev vip_dev - added some error when rk_vip_get_buffer() returns NULL - removed a WARN_ON - made the irq NOT shared - dropped of_match_ptr - added the rk_vip_get_resource() function rockchip,px30-vip.yaml: - changed filename to match the compatible - dropped the mention of the other rockchip SoC in the dt-binding description and added a more detailed description of VIP - removed unused labels in the example V5[1] => V6: vip/capture.c vip/dev.c vip/dev.h - added a video g_input_status subdev call, V4L2_IN_CAP_STD and the supported stds in rk_vip_enum_input callback - added rk_vip_g_std, rk_vip_s_std and rk_vip_querystd callbacks - added the supported video_device->tvnorms - s_std will now update the format as this depends on the standard NTSC/PAL (as suggested by Hans in [1]) - removed STD_ATSC - moved the colorimetry information to come from the subdev - removed the core s_power subdev calls - dropped cropping in rk_vip_stream struct rockchip-vip.yaml: - fixed a mistake in the name of third clock plckin -> plck - changed the reg maxItems 2 -> 1 [1] https://lore.kernel.org/linux-media/20201229161724.511102-1-maxime.chevallier@bootlin.com/ I used v4l-utils with HEAD: commit 3d6682746de535d1f7aa71b43a30af40d52a539c # v4l2-compliance v4l2-compliance 1.25.0, 64 bits, 64-bit time_t Compliance test for rockchip-cif device /dev/video0: Driver Info: Driver name : rockchip-cif Card type : rockchip-cif Bus info : platform:ff490000.video-capture Driver version : 6.6.0 Capabilities : 0x84200001 Video Capture Streaming Extended Pix Format Device Capabilities Device Caps : 0x04200001 Video Capture Streaming Extended Pix Format Media Driver Info: Driver name : rockchip-cif Model : cif Serial : Bus info : platform:ff490000.video-capture Media version : 6.6.0 Hardware revision: 0x00000000 (0) Driver version : 6.6.0 Interface Info: ID : 0x03000003 Type : V4L Video Entity Info: ID : 0x00000001 (1) Name : rockchip_cif Function : V4L2 I/O Pad 0x01000002 : 0: Sink Link 0x02000009: from remote pad 0x1000006 of entity 'tw9900 2-0044' (Digital Video Decoder): Data, Enabled Required ioctls: test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/video0 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 1 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls (Input 0): test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported) test VIDIOC_G/S_CTRL: OK (Not Supported) test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0 Format ioctls (Input 0): test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls (Input 0): test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls (Input 0): test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK test Requests: OK (Not Supported) Total for rockchip-cif device /dev/video0: 46, Succeeded: 46, Failed: 0, Warnings: 0 Mehdi Djait (3): media: dt-bindings: media: add bindings for Rockchip CIF media: rockchip: Add a driver for Rockchip's camera interface arm64: dts: rockchip: Add the camera interface .../bindings/media/rockchip,rk3066-cif.yaml | 96 ++ MAINTAINERS | 7 + arch/arm64/boot/dts/rockchip/px30.dtsi | 12 + drivers/media/platform/rockchip/Kconfig | 1 + drivers/media/platform/rockchip/Makefile | 1 + drivers/media/platform/rockchip/cif/Kconfig | 13 + drivers/media/platform/rockchip/cif/Makefile | 3 + drivers/media/platform/rockchip/cif/capture.c | 1156 +++++++++++++++++ drivers/media/platform/rockchip/cif/dev.c | 293 +++++ drivers/media/platform/rockchip/cif/dev.h | 142 ++ drivers/media/platform/rockchip/cif/regs.h | 192 +++ 11 files changed, 1916 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/rockchip,rk3066-cif.yaml create mode 100644 drivers/media/platform/rockchip/cif/Kconfig create mode 100644 drivers/media/platform/rockchip/cif/Makefile create mode 100644 drivers/media/platform/rockchip/cif/capture.c create mode 100644 drivers/media/platform/rockchip/cif/dev.c create mode 100644 drivers/media/platform/rockchip/cif/dev.h create mode 100644 drivers/media/platform/rockchip/cif/regs.h -- 2.41.0