From patchwork Tue Oct 10 08:24:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 15137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp40811vqb; Tue, 10 Oct 2023 01:26:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiOpyG6KYOiX/jtaxCT96itk3nqddWHpXVYbpMp6Z5L11l+ul7wkMIFvHRZpI1zqMzm4Jk X-Received: by 2002:a05:6870:b622:b0:1dd:651a:74ac with SMTP id cm34-20020a056870b62200b001dd651a74acmr21761356oab.45.1696926398316; Tue, 10 Oct 2023 01:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696926398; cv=none; d=google.com; s=arc-20160816; b=eK+ZX6CDM+f0hfQshScx408xyhLQ2rvaP1tP3lHPwXqi9aHGbjlDG0SpQS3xu3MIP0 jBwbvovSZbn+fZqNZ7zi6DLaH9LvEccXsDoOqydFAPniCtcvct3iDtNcR3brThRBtLB9 rXZNFy99VYzm3jOlUWKQOjX4Zn+2tk1KgyqgeNqPFpUIVIztLg/OfV6VWFbVuVcPDn6u /RQIHvdfKxm+Lm+0CCJXaXuOTg+oA5e5M3kSL7J0wAyySkotU2bf3JyPC2xVtRb3B4nD B68OaErAozVoR8S3/sXkIIOXpgSmfmCbJScTH+SYpXhL1GjcakhB0mKSmFlc0txZgOpc /Jfw== 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=/58iszKxT8/2aQ+luwFtIdDmKUdoz4QGYZXzaU173K8=; fh=kwRLauNNA7AUU9qwhDiUKIYDbQIWr+6F6n6IDvqw4uY=; b=kMmuR/6p7i9Pg9+9pFdeq574HcbwwvHE7VEkFj6U4zQrwa1x9jIcD0epXODsocPRsO pPDsh/SZEaMYyTfky33lqeAta4NURi4RSLwzUJvGI5yVXtQ2S+m3GSrbXaWqo4X0Lbgz ZoeAO6rKsKULjvQXcQVt+PDTnSIEMOmywhamtDuuh42REr7k39Uk9WUOkDDi0NqTi57S 1X6H4QE8LvQZKU4GZpiSWzOxbWY0LdJlh1qmoGsu90NZ2sqy8/1aX7w9gLu2h0J1SgCF mZTlYGSEbqR/cpv1ODfE1c1alLh/OvU1F/U0KDzwGDZqVHc8hHfG+/l/aSanCVqyewa6 +hcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=XqYMpbDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u21-20020a056a00099500b0068a68054661si9563332pfg.71.2023.10.10.01.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=XqYMpbDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6E09880E340C; Tue, 10 Oct 2023 01:25:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442798AbjJJIZ1 (ORCPT + 20 others); Tue, 10 Oct 2023 04:25:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442775AbjJJIZR (ORCPT ); Tue, 10 Oct 2023 04:25:17 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41E9CA4; Tue, 10 Oct 2023 01:25:14 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 39A8HQdY012470; Tue, 10 Oct 2023 10:24:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=/58iszK xT8/2aQ+luwFtIdDmKUdoz4QGYZXzaU173K8=; b=XqYMpbDbZwnz+PXe9q9askN 1Bbj0VS3GTF8rSBS9RQiQjx0dvsuZU4OV3rjYIdM14sXv+rGtZi6aZNQilOyVNl/ guCLbxwEdIkSCRRISCCs9HmXcjCZXbiuoyUwPRQoLi1iRoWpitEG3Ti952wOAzpD KU65GLtmJP9ArCs300EWXmTnOogQn0zcP/VRVOIvltPHW+9C46QQJfJQMsx01cv2 NPFbbJFjGZrT83O1T8z99T0OA8lWFIbj6LKVfv2yobtVDwtezFV9NDlEOpaVrmnE GSncMN3QZ4BeA418xvKDnF3irWgIClE7+1Pc4LERWbvsScuysmGJ6gsOqWtS9VA= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3tkhjg8tf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Oct 2023 10:24:44 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A2AAA10005A; Tue, 10 Oct 2023 10:24:42 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BDD66218617; Tue, 10 Oct 2023 10:24:42 +0200 (CEST) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 10 Oct 2023 10:24:42 +0200 From: Alain Volmat To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Russell King , Philipp Zabel CC: Sakari Ailus , Laurent Pinchart , Dan Scally , Alain Volmat , , , , , Subject: [PATCH v5 0/5] Add support for DCMIPP camera interface of STMicroelectronics STM32 SoC series Date: Tue, 10 Oct 2023 10:24:00 +0200 Message-ID: <20231010082413.1717919-1-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-10_04,2023-10-09_01,2023-05-22_02 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:25:44 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779356294906531340 X-GMAIL-MSGID: 1779356294906531340 This patchset introduces support for Digital Camera Memory Interface Pixel Processor (DCMIPP) of STMicroelectronics STM32 SoC series. This initial support implements a single capture pipe allowing RGB565, YUV, Y, RAW8 and JPEG capture with frame skipping, prescaling and cropping. DCMIPP is exposed through 3 subdevices: - dcmipp_dump_parallel: parallel interface handling - dcmipp_dump_postproc: frame skipping, prescaling and cropping control - dcmipp_dump_capture: video device capture node v5: - removal of dcmipp_frame_size & dcmipp_frame_stride and use v4l2_fill_pixfmt - correct typos & avoid check of available buffer at start_streaming time since this is done by vb2 framework - avoid set of pad format in dcmipp_par_ent_init and dcmipp_byteproc_ent_init since done via init_cfg - reorder bound functions - use v4l2_subdev_get_fmt in parallel and byteproc subdevs - correct struct dcmipp_ent_device comments - removal of dcmipp_hdw_pixel_alignment in bytecap subdev since not applicable in this byte mode pipeline v4: - rework of mutex / spinlock handling - addition of dma mask setting - removal of __maybe_unused, use pm_ptr and new declaration macros - driver now only generate a single stm32-dcmipp.ko module instead of several as before - removal of the component framework usage - various small fixes (function names, lowercase values, indentation, print formats) - register name removal in register access function, only dev_dbg with address & values are kept - removal of VB2_READ and CAP_READWRITE - usage of subdev active state mechanism and removal of locally stored format/compose/crop - addition of port { } within the stm32mp135.dtsi v3: - Have same To & Cc in all patches emails of the serie so that everybody has coherent view of the serie - bindings: correct wording, clock-names & label removal - driver: replace of_graph call with fwnode_graph - driver: use defined bus-type when calling v4l2_fwnode_endpoint_parse - driver: remove clock name - dtsi: remove clock-names property v2: - removal of pclk-max-frequency from yaml example dts - codying-style fixes - correction in enum functions (format, mbus, frame_size ...) handling - drop of v4l2_pipeline_pm_ calls, and specific open/close handler of vdev - video dev s_stream handling updated to call s_stream of remote subdev instead of loop until sensor subdev - code update following media_pipeline & v4l2_async_ api changes since v1 - removal of IP reset call upon error - removal of link_validate handlers - addition of V4L2_CAP_IO_MC device_caps - removal of the frame skip control for the time being, will be added back in another commit once control method will be agreed - change byteproc entity type to MEDIA_ENT_F_PROC_VIDEO_SCALER - various fixes from Dan & Sakari remarks Alain Volmat (2): dt-bindings: media: add bindings for stm32 dcmipp media: MAINTAINERS: add entry for STM32 DCMIPP driver Hugues Fruchet (3): media: stm32-dcmipp: STM32 DCMIPP camera interface driver ARM: dts: stm32: add dcmipp support to stm32mp135 ARM: multi_v7_defconfig: enable STM32 DCMIPP media support .../bindings/media/st,stm32-dcmipp.yaml | 89 ++ MAINTAINERS | 5 +- arch/arm/boot/dts/st/stm32mp135.dtsi | 11 + arch/arm/configs/multi_v7_defconfig | 1 + drivers/media/platform/st/stm32/Kconfig | 15 + drivers/media/platform/st/stm32/Makefile | 1 + .../platform/st/stm32/stm32-dcmipp/Makefile | 4 + .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c | 916 ++++++++++++++++++ .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c | 555 +++++++++++ .../st/stm32/stm32-dcmipp/dcmipp-common.c | 106 ++ .../st/stm32/stm32-dcmipp/dcmipp-common.h | 216 +++++ .../st/stm32/stm32-dcmipp/dcmipp-core.c | 603 ++++++++++++ .../st/stm32/stm32-dcmipp/dcmipp-parallel.c | 441 +++++++++ 13 files changed, 2962 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/Makefile create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-parallel.c