Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1093778lqo; Fri, 17 May 2024 10:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMY43xOoVIQHBHT3lO1H7YXc/kzFtKYFVu9BzSwxgynM0TLeZKVDVKk89hX/AaLSnbbZUZtymY+t1oJICX+XloAxGuHz7TymYvclVN2w== X-Google-Smtp-Source: AGHT+IHeOOxJHnXXHgwNJFdb69g0IjtZKgBSQfpJWVNHB5cZmlCrGuW+6PcaElLzZqDmmRwZCXwy X-Received: by 2002:a50:c006:0:b0:570:cd6:8ef with SMTP id 4fb4d7f45d1cf-5734d67e89bmr14470018a12.29.1715966620961; Fri, 17 May 2024 10:23:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715966620; cv=pass; d=google.com; s=arc-20160816; b=I4hqUfVjPqwVjCXPNfQqs23/YXawptng318EcRS3XFrZuZxIajdAeb5a6zGQBIo0q6 NF8KuOCLI5s2gitwsPershpxXmegqy/5utLcaLnkzentzJ//8H+cK5cnM31TEnhKbPjr /GTlxhbN2xFqxNFwiQcsIu/zaRP7UDK4ud3mjb5D0l1ZoTMprh4gp01SfnVrlpqzeLxf dZGZ46iK34mukDrVeQZXxN2zaZ1+PFFKxvMiT9+uWKdkaw2odtCjhgnJXwLwSrzNPCm6 fWLIzHysoo2XRNvawVZFFbeR9/GeLr3J09gC+B8qsWWqkR1MVFtjEXVmErXpennf5S4Y hleQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=t8moko48WHwLaYXtZeG1loeYfbAEGTbnPD1sU1i82L0=; fh=dLe+C+a9WCaxXr9uM4TIIpLy2vl1+3mg/9h5YLkfwpE=; b=gJe/NV7PNQyZIwykZ9er2Pwcwsn0gRP+M7vZa4kUUPDAt0nD6O8PRXJf6Wjdxszzrt YBrcnfsp6LlsPz2CPAD4yVFu3EgLI1KuhpU6yuvYGBGcz9K/Ejg/9AFZQYjHebjW46LC Q968SP2IkxsrWMWKvXqRvyYzNNQ81Z9nPh4hbeYHsfnl6egJivSBrhYHps0xEIrgKDLR +jv3dsgChURXAwV8KYt4kg81fB10421nbUXLn4axF7MA66H5b8lUWRgna+oKh4vxx6FY DJ5z6Fh7hFvVIpX8E1/a2qAmuxDMtWdfC9DUXKMEI8LHaBNpp5fN/D93QFuTHIqRGsb9 F6BA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hfZTxmgh; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182392-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182392-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57522077b6dsi349822a12.470.2024.05.17.10.23.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 10:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182392-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hfZTxmgh; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182392-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182392-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 370431F27FB3 for ; Fri, 17 May 2024 17:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CE5513DDAA; Fri, 17 May 2024 17:16:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="hfZTxmgh" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2D2C13DBA7; Fri, 17 May 2024 17:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715966169; cv=none; b=excKuu9LzBQdr9CwvoGWAbmgBL5TCB+ScMga6nstULOdQEr2+XDo+CmIYFITm9XM+nAs0BRpZOvSvKfRes6jwiIBlcYTFTiryGIqa7N6HT3hGbio72sxUzKO5sSgriqYIA49QB5iajpgPBif7sTSYthhmkgJ89ermIXdNj/Zj1g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715966169; c=relaxed/simple; bh=5SF0CeCWwV6LZXuz1ZpmJ/axrMdJGeySKiV+1NdDH7k=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=WPv2vwkgUUISc2uPuX8jzkTO4rV7k5GK68e45VRB+0BuEKXDSkGmwj5PZRUbpHs0qWDfuW8kWZhGRJc+apQXVmC542QPX/cXsf+T5N33YIk8OwDhfVtG8kCbtHN9T9sz08XRiSYTwx7seFXCwk9/GhRrE8vBNmokFJfUxSDLxLA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=hfZTxmgh; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44HHFXro002873; Fri, 17 May 2024 12:15:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1715966134; bh=t8moko48WHwLaYXtZeG1loeYfbAEGTbnPD1sU1i82L0=; h=From:To:CC:Subject:Date; b=hfZTxmghkPiT6kevmt5lLE+qDkrLgEXUkuDnSqsVsdcqrdKDdo0zTHYmfZYxoFSVO OvIm5W5WBWEAh6ogEX84zkVIrEpELDT3/Hd5qlHg8t21Rp8bpC/WuuI7WJHcKoVYZq 4pcnnFrta/mEgc/UKcsp19Z2EAgDehiB/3jCHoQE= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44HHFXWd126445 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 May 2024 12:15:33 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 17 May 2024 12:15:33 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 17 May 2024 12:15:33 -0500 Received: from localhost (ti.dhcp.ti.com [172.24.227.95] (may be forged)) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44HHFWXr106902; Fri, 17 May 2024 12:15:33 -0500 From: Devarsh Thakkar To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v8 00/10] Add V4L2 M2M Driver for E5010 JPEG Encoder Date: Fri, 17 May 2024 22:45:32 +0530 Message-ID: <20240517171532.748684-1-devarsht@ti.com> X-Mailer: git-send-email 2.39.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This adds support for V4L2 M2M based driver for E5010 JPEG Encoder which is a stateful JPEG encoder from Imagination technologies and is present in TI AM62A SoC. While adding support for it, following additional framework changes were made: - Moved reference quantization and huffman tables provided in ITU-T-REC-T.81 to v4l2-jpeg.c as suggested in mailing list [1]. - Add macros to round to closest integer (either higher or lower) while rounding in order of 2. - Add KUnit tests for math functions. v4l2-compliance test : Link: https://gist.github.com/devarsht/1f039c631ca953a57f405cfce1b69e49 E5010 JPEG Encoder Manual tests : Performance: Link: https://gist.github.com/devarsht/c40672944fd71c9a53ab55adbfd9e28b Functionality: Link: https://gist.github.com/devarsht/8e88fcaabff016bb2bac83d89c9d23ce Compression Quality: Link: https://gist.github.com/devarsht/cbcc7cd97e8c48ba1486caa2b7884655 Multi Instance: Link: https://gist.github.com/devarsht/22c2fca08cd3441fb40f2c7a4cebc95a Crop support: Link: https://gist.github.com/devarsht/de6f5142f678bb1a5338abfd9f814abd Runtime PM: Link: https://gist.github.com/devarsht/70cd95d4440ddc678489d93885ddd4dd Math lib KUnit tests: Link: https://gist.github.com/devarsht/3f9042825be3da4e133b8f4eda067876 [1]: https://lore.kernel.org/all/de46aefe-36da-4e1a-b4fa-b375b2749181@xs4all.nl/ Changelog: V7->V8: - Add KUnit tests for math functions - Add roundclosest() for supporting rounding for non-multiple of 2 - Update commit message as suggested - Add Reviewed-by and Acked-by tags to patches as received V6->V7: - Fix cropping support - Move reference huffman and quantization tables to v4l2-jpeg.c - Fix suspend/resume use-case - Add Reviewed-by V5->V6: - Fix sparse warnings V4->V5: - Sort the #includes in driver file alphabetically - Rename huffman and quantization tables to not use '_' - Add Reviewed-by tag V3->V4: - Use ti-specific compatible ti,am62a-jpeg-enc as secondary one in dt-binding - Remove clock-names as only single clock in dt-binding - Fix issue with default params setting - Correct v4l2 error prints - Simplify register write functions with single statement return values - Remove unrequired error checks from get_queue() - Drop explicit device_caps setting as it is already taken care by v4l2 core - Remove unrequired multiplanar checks and memset from s_fmt, g_fmt callback functions - Fix try_fmt callback to not update the queues - Remove unrequired contiguous format attribute from queue_init - Use dynamic allocation for video_device and remove unrequired assignments in probe() - Remove unrequired checks from queue_setup function - Return queued buffers back if start_streaming fails - Use ARRAY_SIZE in place of hard-coding - Use huffman and quantization tables from reference header file V2->V3: - Add DONOTMERGE patches for dts and defconfig - Update driver with below changes : - Correct license headers - Use more generic name core instead of jasper for base registers - Add Comment for forward declarations - Simplify quantization table calculations - Use v4l2_apply_frmsize_constraints for updating framesize and remove unrequired functions - Place TODO at top of file and in commit message too - Use dev_err_probe helper in probe function - Fix return value checking for failure scenarios in probe function - Use v4l2_err/info/warn helpers instead of dev_err/info/warn helpers - Fix unexpected indentation - Correct commit message - Update dt-bindings with below changes : - Add vendor specific compatible - Fix commit title and message - Update reg names - Update clocks to 1 - Fix dts example with proper naming V1->V2: - Send dt-bindings and driver together Patch-Diff between the series : V7->V8 Range diff : https://gist.github.com/devarsht/3fd6c4e8031ab114248f93d01c8dfc74 V6->V7 Range diff : https://gist.github.com/devarsht/1db185b1e187eaf397e9e4c37066777e V5->V6 Range diff : https://gist.github.com/devarsht/c89180ac2b0d2814614f2b59d0705c19 V4->V5 Range diff : https://gist.github.com/devarsht/298790af819f299a0a05fec89371097b V3->V4 Range diff : https://gist.github.com/devarsht/22a744d999080de6e813bcfb5a596272 Previous patch series: V7: https://lore.kernel.org/all/20240510082603.1263256-1-devarsht@ti.com/ V6: https://lore.kernel.org/all/20240228141140.3530612-1-devarsht@ti.com/ V5: https://lore.kernel.org/all/20240215134641.3381478-1-devarsht@ti.com/ V4: https://lore.kernel.org/all/20240205114239.924697-1-devarsht@ti.com/ V3: https://lore.kernel.org/all/20230816152210.4080779-1-devarsht@ti.com/ V2: https://lore.kernel.org/all/20230727112546.2201995-1-devarsht@ti.com/ Daniel Latypov (1): lib: add basic KUnit test for lib/math Devarsh Thakkar (9): media: dt-bindings: Add Imagination E5010 JPEG Encoder media: imagination: Add E5010 JPEG Encoder driver media: v4l2-jpeg: Export reference quantization and huffman tables media: imagination: Use exported tables from v4l2-jpeg core media: verisilcon : Use exported tables from v4l2-jpeg for hantro codec math.h: Add macros for rounding to closest value lib: math_kunit: Add tests for new macros related to rounding to nearest value media: imagination: Round to closest multiple for cropping region gpu: ipu-v3: Use generic macro for rounding closest to specified value .../bindings/media/img,e5010-jpeg-enc.yaml | 75 + MAINTAINERS | 7 + drivers/gpu/ipu-v3/ipu-image-convert.c | 4 +- drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/imagination/Kconfig | 12 + drivers/media/platform/imagination/Makefile | 3 + .../platform/imagination/e5010-core-regs.h | 585 ++++++ .../platform/imagination/e5010-jpeg-enc-hw.c | 267 +++ .../platform/imagination/e5010-jpeg-enc-hw.h | 42 + .../platform/imagination/e5010-jpeg-enc.c | 1646 +++++++++++++++++ .../platform/imagination/e5010-jpeg-enc.h | 168 ++ .../platform/imagination/e5010-mmu-regs.h | 311 ++++ .../media/platform/verisilicon/hantro_jpeg.c | 128 +- drivers/media/v4l2-core/v4l2-jpeg.c | 162 +- include/linux/math.h | 65 + include/media/v4l2-jpeg.h | 11 + lib/math/Kconfig | 11 + lib/math/Makefile | 1 + lib/math/math_kunit.c | 326 ++++ 20 files changed, 3708 insertions(+), 118 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/img,e5010-jpeg-enc.yaml create mode 100644 drivers/media/platform/imagination/Kconfig create mode 100644 drivers/media/platform/imagination/Makefile create mode 100644 drivers/media/platform/imagination/e5010-core-regs.h create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.c create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.h create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.c create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.h create mode 100644 drivers/media/platform/imagination/e5010-mmu-regs.h create mode 100644 lib/math/math_kunit.c -- 2.39.1