From patchwork Tue Nov 22 08:57:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Lin X-Patchwork-Id: 627842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B304C43219 for ; Tue, 22 Nov 2022 08:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233024AbiKVI6F (ORCPT ); Tue, 22 Nov 2022 03:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233007AbiKVI5w (ORCPT ); Tue, 22 Nov 2022 03:57:52 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5363C15813; Tue, 22 Nov 2022 00:57:51 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id g5so4204488pjp.4; Tue, 22 Nov 2022 00:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mPI07iSVE5uzkhd5OwFFJcgh7eLm39fNMV2ldIj9sag=; b=OQkhn8nAPkSrM68V6BwhF+ilhFUZGkJgwdomypnQWb/cOyG1A30UtPOp0tHltJlWLa R1NIZTpnjSv0CjK1zFnagEir5UFJSlBYy1wYfoNBefBW95KYCUe9vFS/1lL39hhLW7DK GV6PpE7l+Q6p8nKWc+ncQ42AzwH3kCnaKYzDnv8mgYDAPImndpF/MIikKMIDgn2QlAck TA7ZthPutAVaTYuRbBryeIU2viTRybCAGYkbb6wOap1uHiuFr6IO8lMoGqZzDZ2zm/a0 wBWOyDZslF7LBfpm+aXM38A8BpDKIB6ipVDw7ipEFUkVAPhe+b6M2Caoguj+rnjwAmGK V47Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mPI07iSVE5uzkhd5OwFFJcgh7eLm39fNMV2ldIj9sag=; b=II707aE/WkOLn7jTHr8gNyBIxEkt053TP87fjZT9MNXFyy8EKmZX4tlZxme1CyesOm rkgRkNZdy5z79VShW2m/5IDxdnMnfVHWrG//DOTXXO+7NBEYsSr+Ys8f3j2l9vcd5Heh XozEG7IjqOmXbR5SpRWwpRvB7jNzaPCJKRoK4QVNCueWg9CDAwFw7+iR8XI5lpza/371 2f0R9dRDPlP9uJvfp9IatLgd44wREIPD22ChQd5PQaLg6YIfqTJGgvnyXIeQI0i8Y/jR /YGpqXO6l/8ww2zj5ixjjmDJMITqgKYU077saJCtwOHOmZRydgBX91WJIsxMmLEAmB/T MY8A== X-Gm-Message-State: ANoB5plRmxXvWlqGP2liwWxUWmFLfe1QwrmKyzcpayp6+qJhakgnuaZ5 DZuBKOTSV7HEINCjCkp8Axg= X-Google-Smtp-Source: AA0mqf4AbuVeMTh9dhX6PRFoohzd9/uzku/ZbYmlRAjDZdJhpYETDw/pFDbXDRh2thKP9K4023FBTw== X-Received: by 2002:a17:903:234e:b0:188:cfc6:8543 with SMTP id c14-20020a170903234e00b00188cfc68543mr12202259plh.95.1669107470736; Tue, 22 Nov 2022 00:57:50 -0800 (PST) Received: from hcdev-d520mt2.. (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id u9-20020a17090341c900b0017a0668befasm11400246ple.124.2022.11.22.00.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 00:57:50 -0800 (PST) From: Marvin Lin To: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: openbmc@lists.ozlabs.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, kwliu@nuvoton.com, kflin@nuvoton.com, Marvin Lin Subject: [PATCH v7 2/7] media: dt-binding: nuvoton: Add bindings for NPCM VCD and ECE engine Date: Tue, 22 Nov 2022 16:57:19 +0800 Message-Id: <20221122085724.3245078-3-milkfafa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122085724.3245078-1-milkfafa@gmail.com> References: <20221122085724.3245078-1-milkfafa@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add dt-binding document for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. Signed-off-by: Marvin Lin --- .../bindings/media/nuvoton,npcm-video.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml diff --git a/Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml b/Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml new file mode 100644 index 000000000000..b5be7ef09038 --- /dev/null +++ b/Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml @@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/nuvoton,npcm-video.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton NPCM Video Capture/Encode Engine Device Tree Bindings + +maintainers: + - Joseph Liu + - Marvin Lin + +description: | + Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine + (ECE) present on Nuvoton NPCM SoCs. + +properties: + compatible: + enum: + - nuvoton,npcm750-video + - nuvoton,npcm845-video + + reg: + items: + - description: VCD registers + - description: ECE registers + + reg-names: + items: + - const: vcd + - const: ece + + interrupts: + maxItems: 1 + + resets: + items: + - description: VCD reset control + - description: ECE reset control + + reset-names: + items: + - const: vcd + - const: ece + + nuvoton,syscon-gcr: + $ref: /schemas/types.yaml#definitions/phandle + description: Phandle to the Global Control Register DT node + + nuvoton,syscon-gfxi: + $ref: /schemas/types.yaml#definitions/phandle + description: Phandle to the Graphics Core Information DT node + + memory-region: + description: + CMA pool to use for buffers allocation instead of the default CMA pool. + +required: + - compatible + - reg + - reg-names + - interrupts + - resets + - reset-names + - nuvoton,syscon-gcr + - nuvoton,syscon-gfxi + +additionalProperties: false + +examples: + - | + #include + #include + + video: video@f0810000 { + compatible = "nuvoton,npcm750-video"; + reg = <0xf0810000 0x10000>, + <0xf0820000 0x2000>; + reg-names = "vcd", "ece"; + interrupts = ; + resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_VCD>, + <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>; + reset-names = "vcd", "ece"; + nuvoton,syscon-gcr = <&gcr>; + nuvoton,syscon-gfxi = <&gfxi>; + }; From patchwork Tue Nov 22 08:57:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Lin X-Patchwork-Id: 627841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7DA7C433FE for ; Tue, 22 Nov 2022 08:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbiKVI6N (ORCPT ); Tue, 22 Nov 2022 03:58:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232994AbiKVI55 (ORCPT ); Tue, 22 Nov 2022 03:57:57 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A4918364; Tue, 22 Nov 2022 00:57:56 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id f3so13534097pgc.2; Tue, 22 Nov 2022 00:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HlmLRxqta9FQgz2JIMdWJ3r/aF/SZlMHSxzhMoUS39c=; b=Vo0Nl4Te/9UfymwQw1CZZCYCcSr1W7cpjI0qNhN3xoeD2Db5PE7nJwDPEZH8+SuV2d e7aSHfd1J9QvRKO6Mt+pSGrwVmOgJuM0EelLqnM2RddYanJYPF5QQmTfSxOL5sk6JmZH SHH5xuYD4kdnmVseIZdGVQua2K24MJrMb53+jCHCg6gJdRm/wAW0PBIC3BQfdjIvaZJL 0Ud5JSbk2x4XfDcRtnOZvoJtuk6jsgm2sRAZ/+AEcy6vSmc/0C4uA1+sH4kh9ZQ4tBJX tsKpsJv4espfgS0iuiPXXrevWsYOg643Mo1KPmMLZQLf2BjNDSW9sKsb/an6VzOujo6O c6fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HlmLRxqta9FQgz2JIMdWJ3r/aF/SZlMHSxzhMoUS39c=; b=2+vYYOnCWx2dc8PsjrUo1f7YwryY6Y9mqeHrxuyjrfAjOgMqXrSbZdRI13uht5QANI pFpN5X7bLBdc+Q9f511LLDQOOqiiMVbAddpjQ+dq9xAy44B11BVa+xaXvxYpIazBIvXQ QtFDXFZ7qhRZcnJ+QqhX2Sr9bg2hZsDl1HmVbttYqh5rLbkjJ4Q+RSLXtgrRhp/3/Bl/ AqIoyTzvqmcfyvopJtSPjURZDqc2SuPh14Rvwt1rRdoY6cRDL04Jj50AocrGyvTdv2b3 acqX2MxOyvQ0wqk0Hm/h9rg6oaZVAK3zR5bD7FrvRXpeKWvI2xZDPItWPSRtQQxoyoYH TX/w== X-Gm-Message-State: ANoB5pk5F9epRoAOJ+4VZ54kyIKU0eDnN3liC47Whj0PcJVOt6adKZTX hiy+STPnGO25lYM7rl/Crk0= X-Google-Smtp-Source: AA0mqf57PLEwdGGaJuZ2bnngInGWKv8zQweKSaVVovCF/hr3GzEVw85kM9en05tHuxrCTNCgmOsnmw== X-Received: by 2002:a65:55cd:0:b0:477:1bb6:c6f4 with SMTP id k13-20020a6555cd000000b004771bb6c6f4mr19087749pgs.417.1669107475450; Tue, 22 Nov 2022 00:57:55 -0800 (PST) Received: from hcdev-d520mt2.. (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id u9-20020a17090341c900b0017a0668befasm11400246ple.124.2022.11.22.00.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 00:57:55 -0800 (PST) From: Marvin Lin To: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: openbmc@lists.ozlabs.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, kwliu@nuvoton.com, kflin@nuvoton.com, Marvin Lin , Nicolas Dufresne Subject: [PATCH v7 4/7] media: v4l: Add HEXTILE compressed format Date: Tue, 22 Nov 2022 16:57:21 +0800 Message-Id: <20221122085724.3245078-5-milkfafa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122085724.3245078-1-milkfafa@gmail.com> References: <20221122085724.3245078-1-milkfafa@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add HEXTILE compressed format. This format is defined in Remote Framebuffer Protocol (RFC 6143) and is used by Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. Signed-off-by: Marvin Lin Reviewed-by: Nicolas Dufresne --- Documentation/userspace-api/media/v4l/pixfmt-reserved.rst | 7 +++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 9 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst index 0ff68cd8cf62..b45d8aa2e8b0 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst @@ -258,6 +258,13 @@ please make a proposal on the linux-media mailing list. and it is used by various multimedia hardware blocks like GPU, display controllers, ISP and video accelerators. It contains four planes for progressive video. + * .. _V4L2-PIX-FMT-HEXTILE: + + - ``V4L2_PIX_FMT_HEXTILE`` + - 'HXTL' + - Compressed format used by Nuvoton NPCM video driver. This format is + defined in Remote Framebuffer Protocol (RFC 6143, chapter 7.7.4 Hextile + Encoding). .. raw:: latex \normalsize diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index fddba75d9074..1dd68920cd76 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1497,6 +1497,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; case V4L2_PIX_FMT_QC08C: descr = "QCOM Compressed 8-bit Format"; break; case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10-bit Format"; break; + case V4L2_PIX_FMT_HEXTILE: descr = "Hextile Compressed Format"; break; default: if (fmt->description[0]) return; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 29da1f4b4578..1148546665cb 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -775,6 +775,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */ #define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */ #define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */ +#define V4L2_PIX_FMT_HEXTILE v4l2_fourcc('H', 'X', 'T', 'L') /* Hextile compressed */ /* 10bit raw packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ From patchwork Tue Nov 22 08:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Lin X-Patchwork-Id: 627840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C018C43217 for ; Tue, 22 Nov 2022 08:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233073AbiKVI6t (ORCPT ); Tue, 22 Nov 2022 03:58:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiKVI6S (ORCPT ); Tue, 22 Nov 2022 03:58:18 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D80D927B0E; Tue, 22 Nov 2022 00:58:00 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id s196so13538942pgs.3; Tue, 22 Nov 2022 00:58:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TCuoC3ZK+f0MYOxr5GQA/jhwn1vyzgSzmA1l7LzDqeI=; b=i1HlnyrkOViZAulaPPBGMoLRp+7Dw0lgicmqiuFhVVnNhqFgP4XeRa9OWEIh+SuCYV PoDOCmEbUzivp8E1PhyJxP9YtFZheI/MXk6UeZ1mkP77Za9MeEd+9BkLkLEezUCwnJ0J yEYgUOOKr/KzHOWgzvk8I+0w76IQP11j8aoVtnd57OPipXgEtzSYybZKXvoqJ7ZBWrTq DHEJUL1kin2bV0OhiyjROxBfQdUZCo1hiyJlQJDTGkET0h/zwA9KNOaEJXkHB4NcHiWI yGPJhLWNFTT+8IYnyXLr7jHzkzby5HnMIYUnAIm7AjF0NcCG5AxxEnpp/nUfl4PDMoA1 gk3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TCuoC3ZK+f0MYOxr5GQA/jhwn1vyzgSzmA1l7LzDqeI=; b=SmfCcn2+JK22rkjMu0SL8WEf4hQeAzrfd6R9A15jyryx1D864Dlsum0r64E/W607yi Zp8m3bxmsUOvyi1fOsdyDqsuAlGl+xIVofJ0b4OHn8vHZCGovsIfduZG4krCUk5UFDsZ pmV208n2rmT9KG7w4/KnEM/BqDpNtJtjFJbOJx/rF7cw9XuwtdvpwgIVhOFXxgXcWQ1C UgffILUodG7U4s95tzfLLdwz1kpAZbip/2xitrkFVXILhg6UaumO8+kGdBH2FpKo+RuB 0WVxRaq/DT4kaP9Ole+xjfKfb9GzeihRAeUNyaIjo4eBBGd78hb4G6zPZV+jtYSRsTiT DmIg== X-Gm-Message-State: ANoB5pmD86fhad33TKYH0J53aH4C+bLhxWj9cYs14NgSnNKyblE3NiV3 QgpEZDio9DWYSA5RF+edgcw= X-Google-Smtp-Source: AA0mqf5NtAaMMznEc3iAagqWVa0t+kw+t23oM2duIe7OYDTlQIjrJY6tQFRAp1c75+3ca80xt5y0hw== X-Received: by 2002:a62:1812:0:b0:56c:afe:e8bf with SMTP id 18-20020a621812000000b0056c0afee8bfmr3069036pfy.51.1669107480130; Tue, 22 Nov 2022 00:58:00 -0800 (PST) Received: from hcdev-d520mt2.. (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id u9-20020a17090341c900b0017a0668befasm11400246ple.124.2022.11.22.00.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 00:57:59 -0800 (PST) From: Marvin Lin To: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: openbmc@lists.ozlabs.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, kwliu@nuvoton.com, kflin@nuvoton.com, Marvin Lin Subject: [PATCH v7 6/7] media: uapi: Add controls for NPCM video driver Date: Tue, 22 Nov 2022 16:57:23 +0800 Message-Id: <20221122085724.3245078-7-milkfafa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221122085724.3245078-1-milkfafa@gmail.com> References: <20221122085724.3245078-1-milkfafa@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Create controls for Nuvoton NPCM video driver to support setting capture mode of Video Capture/Differentiation (VCD) engine and getting the count of HEXTILE rectangles that is compressed by Encoding Compression Engine (ECE). Signed-off-by: Marvin Lin --- .../userspace-api/media/drivers/index.rst | 1 + .../media/drivers/npcm-video.rst | 68 +++++++++++++++++++ include/uapi/linux/npcm-video.h | 41 +++++++++++ 3 files changed, 110 insertions(+) create mode 100644 Documentation/userspace-api/media/drivers/npcm-video.rst create mode 100644 include/uapi/linux/npcm-video.h diff --git a/Documentation/userspace-api/media/drivers/index.rst b/Documentation/userspace-api/media/drivers/index.rst index 32f82aed47d9..27ce108b15e1 100644 --- a/Documentation/userspace-api/media/drivers/index.rst +++ b/Documentation/userspace-api/media/drivers/index.rst @@ -37,5 +37,6 @@ For more details see the file COPYING in the source distribution of Linux. imx-uapi max2175 meye-uapi + npcm-video omap3isp-uapi uvcvideo diff --git a/Documentation/userspace-api/media/drivers/npcm-video.rst b/Documentation/userspace-api/media/drivers/npcm-video.rst new file mode 100644 index 000000000000..3041122fe299 --- /dev/null +++ b/Documentation/userspace-api/media/drivers/npcm-video.rst @@ -0,0 +1,68 @@ +.. SPDX-License-Identifier: GPL-2.0 + +.. include:: + +NPCM video driver +================= + +This driver is used to control the Video Capture/Differentiation (VCD) engine +and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. The VCD can +capture and differentiate video data from digital or analog sources, then the +ECE will compress the data into HEXTILE format. + +Driver-specific Controls +------------------------ + +V4L2_CID_NPCM_CAPTURE_MODE +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The VCD engine supports two modes: + +- COMPLETE mode: + + Capture the next complete frame into memory. + +- DIFF mode: + + Compare the incoming frame with the frame stored in memory, and updates the + differentiated frame in memory. + +Application can use ``V4L2_CID_NPCM_CAPTURE_MODE`` control to set the VCD mode +with different control values (enum v4l2_npcm_capture_mode): + +- ``V4L2_NPCM_CAPTURE_MODE_COMPLETE``: will set VCD to COMPLETE mode. +- ``V4L2_NPCM_CAPTURE_MODE_DIFF``: will set VCD to DIFF mode. + +V4L2_CID_NPCM_RECT_COUNT +~~~~~~~~~~~~~~~~~~~~~~~~ + +After frame data is captured, the ECE will compress the data into HEXTILE format +and store these HEXTILE rectangles data in V4L2 video buffer with the layout +defined in Remote Framebuffer Protocol: +:: + + (RFC 6143, https://www.rfc-editor.org/rfc/rfc6143.html#section-7.6.1) + + +--------------+--------------+-------------------+ + | No. of bytes | Type [Value] | Description | + +--------------+--------------+-------------------+ + | 2 | U16 | x-position | + | 2 | U16 | y-position | + | 2 | U16 | width | + | 2 | U16 | height | + | 4 | S32 | encoding-type (5) | + +--------------+--------------+-------------------+ + | HEXTILE rectangle data | + +-------------------------------------------------+ + +Application can get these video buffers through V4L2 interfaces and use +``V4L2_CID_NPCM_RECT_COUNT`` control to get the count of compressed HEXTILE +rectangles that can be put in the field number-of-rectangles of +FramebufferUpdate header. + +References +---------- +include/uapi/linux/npcm-video.h + +**Copyright** |copy| 2022 Nuvoton Technologies + diff --git a/include/uapi/linux/npcm-video.h b/include/uapi/linux/npcm-video.h new file mode 100644 index 000000000000..6d9c77068e45 --- /dev/null +++ b/include/uapi/linux/npcm-video.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* + * Controls header for NPCM video driver + * + * Copyright (C) 2022 Nuvoton Technologies + */ + +#ifndef _UAPI_LINUX_NPCM_VIDEO_H +#define _UAPI_LINUX_NPCM_VIDEO_H + +#include + +/* + * Check Documentation/userspace-api/media/drivers/npcm-video.rst for control + * details. + */ + +/* + * This control is meant to set the mode of NPCM Video Capture/Differentiation + * (VCD) engine. + * + * The VCD engine supports two modes: + * COMPLETE - Capture the next complete frame into memory. + * DIFF - Compare the incoming frame with the frame stored in memory, and + * updates the differentiated frame in memory. + */ +#define V4L2_CID_NPCM_CAPTURE_MODE (V4L2_CID_USER_NPCM_BASE + 0) + +enum v4l2_npcm_capture_mode { + V4L2_NPCM_CAPTURE_MODE_COMPLETE = 0, // COMPLETE mode + V4L2_NPCM_CAPTURE_MODE_DIFF = 1, // DIFF mode +}; + +/* + * This control is meant to get the count of compressed HEXTILE rectangles which + * is relevant to the number of differentiated frames if VCD is in DIFF mode. + * And the count will always be 1 if VCD is in COMPLETE mode. + */ +#define V4L2_CID_NPCM_RECT_COUNT (V4L2_CID_USER_NPCM_BASE + 1) + +#endif /* _UAPI_LINUX_NPCM_VIDEO_H */