From patchwork Tue Feb 7 15:01:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_T=C5=AFma?= X-Patchwork-Id: 5077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2833606wrn; Tue, 7 Feb 2023 05:01:46 -0800 (PST) X-Google-Smtp-Source: AK7set+gn8rEntu4De/A2UgiERGIJG8ixUWr0QKnraruN8T9gCLTPOxY/kSc3Ylp7qWjO2+kTEeg X-Received: by 2002:a17:906:64e:b0:88f:a818:8ff2 with SMTP id t14-20020a170906064e00b0088fa8188ff2mr3314488ejb.11.1675774906588; Tue, 07 Feb 2023 05:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675774906; cv=none; d=google.com; s=arc-20160816; b=K1CCKRh8oyFkaR4Akb7fvC5z4c5YxE4y8baZWj8eWn7+EVhqbvSu2snAWeAIXGDEsf W5Ay2wGzBIYhlOdQbEkkDU4zRu6t/JknmFIfN0F5h7qtpOy6WoBXQWOpWLAMeS+SLE9w rGQqz8dSjIkTZFO16S75pCDj16y5tgom9S/5SN5Ed6vlAEiYYypJDQs+FLMa3ALFGGiB pXMQbciouPGdQbpJWZ8zvadNJyVrJRW9/KUudjLd0+3R3zZueg7nv4zwHKEVRYofbZpb QGas1LsUVyvjoIKo7Njh720ohlka/l6p2TqPZKgwD4sjjlf+bvydu5cNFlLu2hX4uqx6 bHog== 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; bh=MLLxwPFjiYzytRYbyndmVrcri5wK4zuczEzTm9S1vOw=; b=NJZ58KHPZh7NI6Rm52ysqI3A7xSowCjTexZzOlqNMrxOw/wn4o2H77Q3RwRvM3z0UQ T9HccP/QNOhZEojTKHJS7ufTOYS61cXQ9v9AKjyGJhPWj3d3+9svwSQty8mgYElRDpIL B8BSeNMysZIp0dPVLRw0JCdUZCMemfKw4vdyXmj/9AsmK9QLy/8GDsdqdQjpBxfqrcQb XtvSUx9SnNV+BNbpqJscd3GmqzEVlo9DBsPK5oQZGpl2rc+9Iw2pJLmojYnksyRbo5pq Gkvegv2OD7Le55fpCRR9M06YzYbtBaG3Z+MHBRBO8KsL3QA5wZx7MFIMUhZkSLOcfUin E+/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et3-20020a170907294300b00891c5c87dedsi12589509ejc.475.2023.02.07.05.01.18; Tue, 07 Feb 2023 05:01:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjBGM7t (ORCPT + 99 others); Tue, 7 Feb 2023 07:59:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbjBGM7f (ORCPT ); Tue, 7 Feb 2023 07:59:35 -0500 Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1389B1B56D; Tue, 7 Feb 2023 04:59:32 -0800 (PST) Received: from mgb4.digiteq.red (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id D4F0D53C17; Tue, 7 Feb 2023 13:59:30 +0100 (CET) From: tumic@gpxsee.org To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lizhi Hou , =?utf-8?q?Martin_T=C5=AFma?= Subject: [PATCH RESEND v5 0/1] Digiteq Automotive MGB4 driver Date: Tue, 7 Feb 2023 16:01:18 +0100 Message-Id: <20230207150119.5542-1-tumic@gpxsee.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757177348491328773?= X-GMAIL-MSGID: =?utf-8?q?1757177348491328773?= From: Martin Tůma Hi, This patch adds a driver for the Digiteq Automotive MGB4 grabber card. MGB4 is a modular frame grabber PCIe card for automotive video interfaces (FPD-Link and GMSL for now). It is based on a Xilinx FPGA and uses their XDMA IP core for DMA transfers. Additionally, Xilinx I2C and SPI IP cores which already have drivers in linux are used in the design. The driver is a quite standard v4l2 driver, with one exception - there are a lot of sysfs options that may/must be set before opening the v4l2 device to adapt the card on a specific signal (see mgb4.rst for details) as the card must be able to work with various signal sources (or displays) that can not be auto-detected. I have run the driver through the v4l2-compliance test suite for both the input and the output and the results look fine to me (I can provide the output if required). The patch requires the new XDMA v10 driver from Xilinx/AMD from the dmaengine mailing list to compile/work: https://www.spinics.net/lists/dmaengine/msg32151.html Changes in v5: * Removed unused includes Changes in v4: * Redesigned the signal change handling logic. Now using the propper timings API in the video input driver and a propper open() syscall check/logic in the video output driver. * Fixed all minor issues from v3 review. * 'checkpatch.pl --strict' used for checking the code. Changes in v3: * Rebased the DMA transfers part to use the new XDMA driver from Xilinx/AMD Changes in v2: * Completely rewritten the original Xilinx's XDMA driver to meet kernel code standards. * Added all required "to" and "cc" mail addresses. Martin Tůma (1): Added Digiteq Automotive MGB4 driver Documentation/admin-guide/media/mgb4.rst | 352 ++++++++ .../admin-guide/media/pci-cardlist.rst | 1 + .../admin-guide/media/v4l-drivers.rst | 1 + MAINTAINERS | 7 + drivers/media/pci/Kconfig | 1 + drivers/media/pci/Makefile | 1 + drivers/media/pci/mgb4/Kconfig | 17 + drivers/media/pci/mgb4/Makefile | 6 + drivers/media/pci/mgb4/mgb4_cmt.c | 247 ++++++ drivers/media/pci/mgb4/mgb4_cmt.h | 16 + drivers/media/pci/mgb4/mgb4_core.c | 641 ++++++++++++++ drivers/media/pci/mgb4/mgb4_core.h | 65 ++ drivers/media/pci/mgb4/mgb4_dma.c | 123 +++ drivers/media/pci/mgb4/mgb4_dma.h | 18 + drivers/media/pci/mgb4/mgb4_i2c.c | 140 +++ drivers/media/pci/mgb4/mgb4_i2c.h | 35 + drivers/media/pci/mgb4/mgb4_io.h | 39 + drivers/media/pci/mgb4/mgb4_regs.c | 30 + drivers/media/pci/mgb4/mgb4_regs.h | 35 + drivers/media/pci/mgb4/mgb4_sysfs.h | 18 + drivers/media/pci/mgb4/mgb4_sysfs_in.c | 780 ++++++++++++++++ drivers/media/pci/mgb4/mgb4_sysfs_out.c | 732 +++++++++++++++ drivers/media/pci/mgb4/mgb4_sysfs_pci.c | 86 ++ drivers/media/pci/mgb4/mgb4_trigger.c | 208 +++++ drivers/media/pci/mgb4/mgb4_trigger.h | 8 + drivers/media/pci/mgb4/mgb4_vin.c | 830 ++++++++++++++++++ drivers/media/pci/mgb4/mgb4_vin.h | 63 ++ drivers/media/pci/mgb4/mgb4_vout.c | 501 +++++++++++ drivers/media/pci/mgb4/mgb4_vout.h | 58 ++ 29 files changed, 5059 insertions(+) create mode 100644 Documentation/admin-guide/media/mgb4.rst create mode 100644 drivers/media/pci/mgb4/Kconfig create mode 100644 drivers/media/pci/mgb4/Makefile create mode 100644 drivers/media/pci/mgb4/mgb4_cmt.c create mode 100644 drivers/media/pci/mgb4/mgb4_cmt.h create mode 100644 drivers/media/pci/mgb4/mgb4_core.c create mode 100644 drivers/media/pci/mgb4/mgb4_core.h create mode 100644 drivers/media/pci/mgb4/mgb4_dma.c create mode 100644 drivers/media/pci/mgb4/mgb4_dma.h create mode 100644 drivers/media/pci/mgb4/mgb4_i2c.c create mode 100644 drivers/media/pci/mgb4/mgb4_i2c.h create mode 100644 drivers/media/pci/mgb4/mgb4_io.h create mode 100644 drivers/media/pci/mgb4/mgb4_regs.c create mode 100644 drivers/media/pci/mgb4/mgb4_regs.h create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs.h create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_in.c create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_out.c create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_pci.c create mode 100644 drivers/media/pci/mgb4/mgb4_trigger.c create mode 100644 drivers/media/pci/mgb4/mgb4_trigger.h create mode 100644 drivers/media/pci/mgb4/mgb4_vin.c create mode 100644 drivers/media/pci/mgb4/mgb4_vin.h create mode 100644 drivers/media/pci/mgb4/mgb4_vout.c create mode 100644 drivers/media/pci/mgb4/mgb4_vout.h