From patchwork Wed Jul 13 21:11:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917120 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 EB48FCCA47C for ; Wed, 13 Jul 2022 21:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237344AbiGMVL6 (ORCPT ); Wed, 13 Jul 2022 17:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237335AbiGMVL5 (ORCPT ); Wed, 13 Jul 2022 17:11:57 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFC6033374; Wed, 13 Jul 2022 14:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIz21XCdbHeBSHnQEIqJFt53ba+xO1bXmFVSro9auwPMRmS1KVdkp25mY/Rq0bI1E5JuoxPBBdM6273qKkoQZrWyQAgJ8coM9YtcFsR2ZxhdK7m0ooalq5xaTV6CeLo8+4rAPa2QMwfNMR/y2IReymSxgjKAIxBPw8mUSoOGmC7/P9Xm5YtfW3p+BSosm9EROJxiqL0RB0CPJdtx17DmHHDbINHx1CAGr0287ZGuwBE+S8Zu5mtxy6KaCrWInDS96UTIp1pdtOINRDeVXiE2Et7uSsArPYOVjVuKJN4TZt+QMVXL5c9oDR8easYIgSz0PKYXv6FjUXD8AJlSabDnzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qo/HmeunH1NHG1XXb0xWwHqLuUBAYsnJzAwWvlhyq0U=; b=mTn3bVsUOMw5D7X4Em5586TY1os8ORmgjhNmW6Fc1Uix4Cmh7aluaqBZKtLh02LXGsAWYtDECHQ+SHsOW4hinPDqAj0sYYoovbnqkhGr77klzK2phK/u+bHe2cVgjt1HY/V9q5Q3gd1iUtkpxaepSLCzqU+KuCO3DeKp3XXj28fGqasUkixB8Fh3BFx13c+Cc1aN8N5T6VDpS3mzb/hD7l4lpLg/8fQMGNbjv7sq3subOPC23QftE0w+ZtagNve7Vlwu4I8zY3NUVuatwsFVCFX2lMvp2Ff+mDqtvPjSBUYjbP0alRSg26As5HSf73LJuIocNnGeTPPgSxBwloIPbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qo/HmeunH1NHG1XXb0xWwHqLuUBAYsnJzAwWvlhyq0U=; b=Ic+IixFlYmLHS7sL1l8G95XcKId5wT4Q0vyHEdtgENZ7GQke0UDJsCAPMSi1BS8MWjGBGq/1rr3+AwEiyDX4JIjdXWJzu/4MsCuU9jo4yQFi4gphOB3yW9/gjOnCzvQ0rXT7IfrFygmnJqJiBatImTcZXKnHtdrnujeCDUTywk4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:54 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:54 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v7 1/6] media: Documentation: dw100: Add user documentation for the DW100 driver Date: Wed, 13 Jul 2022 23:11:19 +0200 Message-Id: <20220713211124.2677275-2-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdf31417-4d31-4a99-044d-08da65145029 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e4zCgc2YaFZGbrsc+ukQoLonU7gQ19enyUc7KZXSR4cAe1yFv1lrups0CFC1KYARDCmpESCpavlFHxqoMrQ1g2vDVwfSzQLNsTiHf4yMwZxdI+cbGkxsO2Crnfhc09X75K0v6Gl5q0sIfg9VdxWbjXWP4jnXUbop2/EAY2cfgqTi1wwoLbb8RDlqlN5z+jGlLTIR/1/tNVlSBmYnkEAKtaK52QCLkSox69RqqTjOL+PmPPrPyumTV7BE/d1f3IGJC1Yt3jA+nmDQ+sp/W1PuZ2ShklS9A79F1lJRVCFpr6JiKkSc96IhWOx6/ukQIo9fkD1HT6YS69mXzkKTe2+rYCeuJe599gb2ZC03hUq5bl1NeFPPLTKJqZyZgD5CzjV2Z/lrI5c1HkpKWos1KClG4YbFJUv5IvlRULzOl+XRWFJIkV2+iFpgjXilz32fM0JV7vS64JfO8zS20A1TeG3vBPQZBqZ98tR/qVK2SMmo8zCKhnZO099I55qdpVuVlR4egf79dMh78wKh5R0owMsY6IYIjuGlQZJEtYjh/niQjuV92I3KU1EaW2BZK3wKU6luOF4tVU3k6tVo5zlXVLq0UtTrUy8y4GpG5rhvXUNhGUzRNyh0fJsFx5hWpesqAiBDi0IJw2xP4/2MKcueSVFf3cnWLDzWCdTMcePZLiCJH4/jZEeVrzmVs4PWuA1Epn4tGIdR6lmp7MaM4Y9K3t2lFE7lOhHRdubbaStSlGeuGtBoV1OmhTordh2BngT8j5lrmpjKM5zpAYF6WbTt940dgMp4KWfPwQaNMpqqFkrIcUs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(186003)(83380400001)(5660300002)(2906002)(6486002)(6666004)(966005)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pGnndqLLRy4yt90Yx77rtWK7MonxjP2C4/Usu5MH3gvSsBgejH6BjeMK3d9ZXbnZ0h/LZOvC7Bu97wsnPfVhyVc9up2qYN6Yxkr8YCzpC54Vamf6ka7r3HKGnrWKyauCF1pYiq9cO9Sz1b5CQE3sFO6RmueH0TvyLSfU/qpUHW4g2D+CUwMOsBy3Sce3E7HueT81lUoVuGnYVSMumjUOJX3jV471ntrP/FbjCPflJjttknXZoJeCyp1qvho1UoAeLE4oc45ibl+yrvSja6tYuQPTFgsafaS8CSQZgAuSCttQUQ0if7cczQrLHkz2BMfYMZ/Ix+rWbcSpU6lVqbX3HFCefdf5MojNIuamfhssrxFIMr5SKN9VXAtr9CHXjOAqhhy1qhRUuIKwOd9i2W1gesBRunqJWIkCPnZ9zWAvHYK7T41OU13XD8gCjcyIIJs2l+9GtVgKpYojiRSXBzQcN9LUPHp4vT+ZoJSE+AdohdagIgRZK7fW7MPuxllGw1RV999YBFhbLFyYu4okKjSebIKBgcLkgN6w69WL3FOLbNraSCDCQNSVJtKUwiiN5+Q7wJeY9jPxfuCW5oeOg1+pLtgsv5AWBBggprOk7H26+wt3DtYbx4VnxWhKuFx5rTPx2UIDhgZ6RPVv9vUMKS92Wy67nRium5M51obxVAHRs8p9ITd+Etjukxr8bdOl9OB9HpwVCjddeDUqH89SZ81KDBEm6JyQOouXLrY4tgrdT0Tk4vwayAtiM7O2HDR8Lhr6ewirzGeTpKYc+cELxXvt+MAEEe82ItjO3xqHs5BTKm56MWs1TUZExy1DLt+VpOtnsdIShclij/QSafXymmQJ+4aplBtPVtbqCHZzveO9tQ7Ccl0Z62cdQ8j2CqrmQjnYYIbGY415Z8teYDJjlJ0UM+VO9MBVVl52onJVsBUeS6l7lVPFM2eb8DPzwaEzTmoF5uKj5F+IpneF6ifK63bBzAnqFo242Rk5Vg9Hf2Qhy7GmGOb+g1CkaV+VYnTFiSaFjD5NPB8DOGNQ8S8RD5skb1wXVWoRQC3YKffwMl5cki6gLuXLI0PcXSWohNUhEP5oS/gzfjAWKUTas8WCJ1KUcVru+jKfRENKK0MmSydZLja0tVexQeA9DV1OIJyqO1rQvEteHIYgsQXIadmr7OiMxqQwpLkKt93B4PbqpWfx6Y/keoYZDYfKWyJh/BBoVtXZPA2bkoY7Mt72/lT7asfD2vEdb1cQuhw1C32ck3w/stJfi91mLsQrR00McZEhmvprA26uCbcodU01+eHoC0k6Qrt7A/6klWDxZgzo0Xi0rG39SSo3e8QumRX4FBK+6amQJN/VybIGxWCGUx2YEsZPToOXxpRP6YJtOZaPZjfIsuHt1GdWGFTTWPBxAxHTG3nztmP2P1IUAGZ3CNTTANz2ByQMKBInHNbM+WvnWWVWUxaBplV9lU9PfZPdcExX1ZNKCUUN5MXhXZNZSsts7VqB1CQLNDIrVevdmjUt48P4KbW/ZkkvLOxmZ2YdcbWP67tfpfNcde7qzVRRvEJZWguYFsuMzH5XEMC0rBsn11klpTyerGgUgBqOelINm0yBRXhf1Pm28T2gOtMcZcLQXNFx96bjZ8GitGH+gEy+dnqdjZ7DmV+zscPzb0aATcspln4SkcFaFqm6MkzURwp3Se4IDg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdf31417-4d31-4a99-044d-08da65145029 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:54.6382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EuhU2Q7cMmSVLGFWRr0W0sTfnBoXHFI1L+4x/CUdQ9m292W1CZZCavTzkg5vghAUiCIQ8bUG74nsfCyaLlglbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add user documentation for the DW100 driver. while at it, replace spaces with tab on drivers list. Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- .../userspace-api/media/drivers/dw100.rst | 69 +++++++++++++++++++ .../userspace-api/media/drivers/index.rst | 3 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 Documentation/userspace-api/media/drivers/dw100.rst diff --git a/Documentation/userspace-api/media/drivers/dw100.rst b/Documentation/userspace-api/media/drivers/dw100.rst new file mode 100644 index 000000000000..1ca6fa55f539 --- /dev/null +++ b/Documentation/userspace-api/media/drivers/dw100.rst @@ -0,0 +1,69 @@ +.. SPDX-License-Identifier: GPL-2.0 + +DW100 dewarp driver +=================== + +The Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC applies a +programmable geometrical transformation on the input image to correct distortion +introduced by lenses. + +The transformation function is exposed by the hardware as a grid map with 16x16 +pixel macroblocks indexed using X, Y vertex coordinates. +:: + + Image width + <---------------------------------------> + + ^ .-------.-------.-------.-------.-------. + | | 16x16 | | | | | + I | | pixel | | | | | + m | | block | | | | | + a | .-------.-------.-------.-------.-------. + g | | | | | | | + e | | | | | | | + | | | | | | | + h | .-------.-------.-------.-------.-------. + e | | | | | | | + i | | | | | | | + g | | | | | | | + h | .-------.-------.-------.-------.-------. + t | | | | | | | + | | | | | | | + | | | | | | | + v '-------'-------'-------'-------'-------' + + Grid of Image Blocks for Dewarping Map + + +Each x, y coordinate register uses 16 bits to record the coordinate address in +an unsigned 12.4 fixed point format (UQ12.4). +:: + + .----------------------.--------..----------------------.--------. + | 31~20 | 19~16 || 15~4 | 3~0 | + | (integer) | (frac) || (integer) | (frac) | + '----------------------'--------''----------------------'--------' + <-------------------------------><-------------------------------> + Y coordinate X coordinate + + Remap Register Layout + +The dewarping map is set from applications using the +V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control. The control contains +an array of u32 values storing (x, y) destination coordinates for each +vertex of the grid. The x coordinate is stored in the 16 LSBs and the y +coordinate in the 16 MSBs. + +The number of elements in the array must match the image size: + +.. code-block:: C + + elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1); + +If the control has not been set by the application, the driver uses an identity +map. + +More details on the DW100 hardware operations can be found in +*chapter 13.15 DeWarp* of IMX8MP_ reference manual. + +.. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM diff --git a/Documentation/userspace-api/media/drivers/index.rst b/Documentation/userspace-api/media/drivers/index.rst index 12e3c512d718..0c720ca1a27d 100644 --- a/Documentation/userspace-api/media/drivers/index.rst +++ b/Documentation/userspace-api/media/drivers/index.rst @@ -33,7 +33,8 @@ For more details see the file COPYING in the source distribution of Linux. ccs cx2341x-uapi - hantro + dw100 + hantro imx-uapi max2175 meye-uapi From patchwork Wed Jul 13 21:11:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917122 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 52AADCCA479 for ; Wed, 13 Jul 2022 21:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237352AbiGMVMD (ORCPT ); Wed, 13 Jul 2022 17:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237335AbiGMVL7 (ORCPT ); Wed, 13 Jul 2022 17:11:59 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A120233369; Wed, 13 Jul 2022 14:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8v+0GrZjLgmPurdxOjyL0uXAlCCCHRrU2+YvKYeBk/I4xjcutaeArqtvtwRpDF3ezdq+FTkNtcBAW8qooTPRYkvpi72ZApQf6Tai7OJ/f5iz+IjA5SgnNDagRNA8D7WZGtdN9V+hcWfQ4jJOMRPH+NW7vrRTN+Wx16kp5j8b+bsicHdgeFvryiSoSnd9CFYvZWGRwnwnXzI3tZIIBenVxHeL+0aeXeXushoQYNmDqnzC+y67IQJBFpmUCiF1x4MvAVQ/m170hT6SDDWLISNm1pTTZVmeMMV3yvmybMcu01XqgfkjcZXWAK03kWPjnNmR50Z/AP3RHQoFvkOPYVqYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aXAAGNfrNiSMxe/ey4OTDpi0XLzQaqJVF9QrNOOgtV8=; b=DD2SfqkTRC6Qd1U3qwhRx18gUocW8rc6RNF6adsHz00KlZjeKll4jLsffPMhboY9qkRKVQL3WE+lzXinTxghe1gKMC+0pf/vfYWBxbCViw8spiVasfNnmgseyepcjwp9yU4xWLibfWu8VUYWjKbKZNAqab09gCLQc1Abvx18Fu4NR2dzam6Z7IPZkaQ15xRug5xEo0Kcj4xASGq05F10kxUDoNOlrwoqcB9S+Ln4MmqTY0wOfKJizGbWJ7Y5gIx9yZJ9CQhmW5A8T1FHBsprvAboksiaq/g6D7lCcRIFrD3Ps5x2GYss0bm3B7aqDrFCi8tqbeY7tPjINysPMHBU8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aXAAGNfrNiSMxe/ey4OTDpi0XLzQaqJVF9QrNOOgtV8=; b=i79IPgH1BQgAPMLRTJNe45PdDqtdN1Nr1FObR+koOSme+dzf/aJn3bHmhCXBxafYHAIGzsEdd0JOTMwn4VyfWxzXAlNw9gX1bz0tk6zoh/Joo4fsbkHkXyIMVP6kLB84mxjdVZyigdS0m5jLcsemS2YLViJnWIPB3iHq1slfZMo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:55 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:55 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v7 2/6] media: v4l: uapi: Add user control base for DW100 controls Date: Wed, 13 Jul 2022 23:11:20 +0200 Message-Id: <20220713211124.2677275-3-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b5a92e2-3a28-4252-7ff2-08da65145075 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VVjYj40Fw4xQT0sK5Ib0gZM57X81MZGE6MrNTwWe3RhmuN/aogT9ogflP0Dpru1PR/ZFhOYlWGnOhkPvGu58cnUWej/SbSkQiNhZ8nG3w8B1+P5GRkMrtRLELEXTJoCuv7000kQMZZIIfZeJedwKnIWeG0W4sO1aY9g1TzWKUXWJtJ2FjM+nRg2wEZEISjqZ2V94oQY0M5Wf56497lDOUCLcCIV3/obVhSyDJfjFat1M3dRLVCLluooNIKDKU64PywDm0YFz/a2eTCthY+s2dnzHTtCCnR+ieHNzpvcMj2lFIhNX7YY2ljuozRkmEjBAvbh9CebFo8f8GVa3kVZVK5coTUyttJdK8A1sUgCtOnZHMtA7TyFEY+//emSVFZaS+n0+xAHgRs8hrH5o9X4Hhy2wGJCD8SfeJ5oxPVNuC8awoJx4G6G9EeQVyZpboIbFaNKaUTP4E/KYXmH+dXjYfCQLQbjqjsi5FJtiKNo39Mi9MIigWnIlAHvv4afr47VgDmo/y+7C0x3srxmxKnnUJjyvCMP4Q6KqN+Nw6OHV7w1lv2WEAVGJWCLVsww3srk73ISE536pDgV0lXX44/Q6rNQHxDcR8XQyVNJ0tpWN+2acNtR6spTTwhBRBFK3cv2+prLqFeQG2IuvxxOv876Tc1P2y+We9+iu2u46HWiTQwCVi2/FAUd3BGLFz7TNOuZlg998rmxGXNZUQlW4/fXMttNbuXoblxwsB9Brkd8cqoKXfV2lz0T+szRpPdw2e7nQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(186003)(4744005)(5660300002)(2906002)(6486002)(6666004)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yYyMnjBarPvKIW6sudqJhiOHLpNGJVmGWyqwRTV+732MJTgB05I6O/cJfbxtEZc8J8Gn9al3bAiT8rWh0A5KvslJDn6puWTFaHCJYQhz3RrsMvF+Uoj/X3dRmqq83cmTyziTQoXFJpt2McjwB7PYhl8RvMMOcJ4fmq+aPgLjo7mKswoPz6RS9KfcVEvdSJm+ILD/yL904pGDNx8Nv95G9S3p135DZANXP7m1nxmq9DCDpfzo6Iv3Q+rqSXUdYmDvovkS1E7PCxkRYRcOSOXqrOXJsEM1oGoFa8HuKGUGyNCs4H9B0pVhZKJWwPB3TRMtJYr9OdSs1s72mN8ugeFLi2jH0hxgPx3+nvOoJf/L+iLiWoHFKqWgB2QkInD4i+RySpb6Q4d5ZfM8Ktub8HIwfgeutnod9kXhN3Xy73KHojlZ+Fs7c/LZWi6AovRdRllpeklWgnUguohg0s1PiczOPFjhRJKVZbjuq1D0VvErPTCM1fRwpYFe00f8fSUve8XRG4uCT2loC7idqJUBz4wTRcwfL1JYuoxkHX9kSzVMPGVXh+0yds8YLPDto9lV1O5TBPxnaWvrHnnuOc4jFS6FfQ2NuJh0XmYFVBjPKScutd1IdTtjCav/A4cs8Mjw3hj71FC4Clb2B5TyW9JPrbeNqoPCHDsRbpOGM1DJXD/oibNnubCeOCnLlAv7z3WT8k+k95ngaEli8nm2Aiy7+G2OA97wTFU39rgOWmIxOzf839gyN0eEw4xK8Gw/xD8iinQJfB8nTuH+vC1C9yri6avAsInpggCdkMWwVTPkUKJ8YO8c387n3w72c7YOzM8/0Ldtfdalqp4WL/BtLzp2GtcFCdy9984F4bshDQFYEJ+L0kOw8f3qXUFZqff4RBCHm2dbD3/98YrodXokESwE3GsPt+eUvvxQahBh3b5hPfYt6mgxGz7H0EZde7pkF8dPYEn33SrC+EUIjVBAs1RG1DyX/yKK8P45K7jNRg75/av9B6qyrwavhecefvbS/p14I2RhrphzvVzKYMw4Y1LeSIvzlEMjK1Y5kYmfz8LEjgB2/QfRj2IEEd8EPyWmPXL/aXfMOvSD/OQQ0wQg45SzjTnP6y/AFDJpUZu439LtAxpfS3Udid7xJcjFHwWlTk3heAZrQss9mc/RTyCk2VYkbTdwagWP74nTBabalfNwM/YRYBXzZEv3P/Ypwm868WCW1xotSjNItrYxXduw66tsh2/cxzDaUFqfTlpNnj4rdkN4jLhr52vwLrLcA3ICnBhsi1vxHoXJOmh/oXhFuw6A0U87dwBZ+k5iFjElsbajYtHi5iTzYnEbMpzsiYzlNPKnWa+widqkxZjWGu870MPcucUZdjBY+F8zO9AAJcSD1ijhVF2yBcBNhKk7r3NJ1sHl6LDU1+Gwk8XFXmlFcLaRwCPBj53QUlL8KS/ZyHuffJs+aej+GgatX7sBQqM78Nn8SLK//dF74JUDe3rJI+W4AsOBMixITE4v+/n48ApO345Y/r5bSZ6+bhszNx9iYL6v4ndYTpeDdrgJrEtQcars4SwiYW7046xvxfxjYoale173o8htoDPBcTp4Gr6borhoKwsfVwjxtEloLmmdVcl+IG3vDmKT4UJkgCzxDztyGbplwWH0ekYd0qZ8Qx84pBg9ECKD47eV23O0JRbGKT4iNQIJVg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b5a92e2-3a28-4252-7ff2-08da65145075 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:55.1527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qUCnGpFlky8z2EyNCZ+1/MO/rjJwqhLn2fQSe/80+Bl4dGWG9WTv5rpiptPzcZrUD/Lksb8JfVqP//EwZZC67g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a control base for DW100 driver controls, and reserve 16 controls. Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index dfff69ed88f7..0b26ebd6ca78 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -225,6 +225,12 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_ISL7998X_BASE (V4L2_CID_USER_BASE + 0x1180) +/* + * The base for DW100 driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ From patchwork Wed Jul 13 21:11:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917121 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 67DD7C43334 for ; Wed, 13 Jul 2022 21:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237353AbiGMVMC (ORCPT ); Wed, 13 Jul 2022 17:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237345AbiGMVL7 (ORCPT ); Wed, 13 Jul 2022 17:11:59 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F8433400; Wed, 13 Jul 2022 14:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LRisGBsJT9FizAZ42VsZ+p22a1zJ2hDird7+AOzgPDQM9Lppcng9igd4vbPpHo6aJEUXTIkNY2UqRDYYZDEG7m9j1hF7ueJwt6yvAeKkPJhiCeDTX8lz27TV489xpzBMPsCUxmi96idF3Fu8UbCwD12ZXMK4rCBkCuGQ1yR9Gh2s2GwGxrN29y3iuspIqLlXEYB2+NsyQW6FguZDgufyud1WXv464XX9oe66LRDlNZIbLWf+On/Bkekz6x4URqF1LLjByTuw8k87HR+Rgw+aLvgFjNUym/UuxDogo9pn1xQu/qSbgmVO1XLHzocq4nMSsgSVKiPD9M+F6FYrYvNiRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ervFkx/u73e7LNB5CzxBael72hFEpKh5geegkyMMdeY=; b=JKtZ0VUJrtWO3i2IryiuDp/l9YFDX9CLCH1aSIjzbCGdvuJkOAqN407VYoD1/NC9dtv/oU5pE3KQsqzBZBqbhpPQTFTA8gmSG4uOntIPVDVxh5rp/GqCApr5YiF0MZDdwUo/Wf8kr7+UMzvyap8EU5z1aEkP7Xg7YuEKuWvvtKfTGFt/y+hgWI9LSeTyGSRS6HLRDm9dzsJwf7Jlr8Et3CnPKMe4sAjNQcSnRlSbOWWv6VRMFGqTbOBR94ugNBlT6AiDQfH4ofb52BR+Kr/HINLsjSXE4h/Qf+96m2pgyvA1vym1Zhbnmj7qaDDWGAbmrSZinsvL3QzVnQXKlnCqJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ervFkx/u73e7LNB5CzxBael72hFEpKh5geegkyMMdeY=; b=RDU0wK/ioFsjZwRXxlr0/jHf3ToWBsFe1NgH9+TLhnHp4NkohntweXp8Jpkj4wQbeRdZ8R5YyMlogaAy8zvjlSgcEkiWEZ4soS3vKfk4aN0lBSKTtRUQm5YDsEkRJ1SCplE28/pQvw9Oz/E2iILMrqa8ppNtbbtdw4XcHnwOKc8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:55 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:55 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v7 3/6] media: uapi: Add a control for DW100 driver Date: Wed, 13 Jul 2022 23:11:21 +0200 Message-Id: <20220713211124.2677275-4-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0741499-6413-48fe-9e5b-08da651450c1 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7RwkW5jpj1MDhq1NrOTjEX+E3PWHpjK2Kwr3VC5007y7Nx0sT6Vaz1FP6OvlIpJf5e4m581ZablJKTIVNyKQqA/P5aP9PppW+dDaJNPGFzMkbh5ri/g1CZJpC2lIeOmdXUW5wk+0v5DoSM2v067kOLdhsD9oGHZTTqgZshQjpYQMdD7J/iz/TsbtIPFp/84M8XO9M6xgh/p/r/uWnoYcYtC0ISI5Y4C8igkUDu5pHQr9i7hALGtV3EUdnVCieHZK70YAGvYnyWThsdtrxIYIeeCYjIpbCZwlXCshNp5yseyU5p6dvrNFRZspwBaHED1PGGMWdkxjtdCko/Beo9zOXkFohSv3JpIM89FdvvDml+TgI9VP8vl94GW8uMAZTQHim/Rxa7RI59jjZjVBuWhTvbvbOlwyB4W/gxgFYZQplpd7FK11S5Wg00wAggOBjmd6WjJXXArfad0iOlgFG+ERbywFoqhk2UzKqr7j88deJMudhTULmobkOdx2U++lArorZxl0olJrwedDUg/w9k6IaP9jd3pFf0miYurs2GuLbhFb1CpARVbbRHqoddTyTUuqhFpPLmQUEBRynPOU+xCrpUHczU+dRm+Tx5GRs5UYOfiHhxgNzPoedk9Kr7OKHx2MMb8P/gYh6NLASPf71NK/dul9M6HYQKdSEhohhktWUNmCWmEZTrekejqKQc79/vQBpzKWkKrpTVfzn2ZrTnKbwJBaSn/m5f228Ma6wNZq04JXvTuW/Gs0ngosjSwyEshmRgUMOZ6/UO/B3vmXz4CvwPp7LPgcYywwqxKcgUz7ft8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(186003)(83380400001)(5660300002)(2906002)(6486002)(6666004)(966005)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4A1EEPzV784W7r798IBYQU8fFMop/CqtLDnvZI9mUksvAutEiKBHDRk5YP42gnBqsmNDMla6esfxYoBjLKDQTLyReeUPwUubl1zgqms4yZx/MeWGxOlgBISgDrm0gfD6oS11U1MgM+cY8fpBsk3Fo/x48ogUvUaFFa/YjXv7Mb4Odvee3T1ftMyRRkdQeD3DRUGZ6i8xkNHESXhkjjUG/3Pv0kG1a63x2ZMKN7oWItLFU7u1UOTejGXmXH3RZAG61b1tWlxITekOTGWYWzLzeiGspLT4RQYs3CCiqGCJgQ/uFiJT2Zdfrhkfz1oT5Y6hIoPK63mYHpLwAkylIPtJgXwhHX8IsKs+6p5ktWOwqxqjOXML0J/44EZ9pMmuqOI72oYqNMII9hTmMJYNrvjVIer/sBH918q93X+Cgghd8HGOKEOg7zX7Jj2WFCmFcThlugHlgJCKzZ7qFOKz6/6YSEM3f9Nv36dUbtP2Z0LG6nyMVmk2bcGlkJwoEAoT5l5xFLFkhttVfQMMa5nLxAc4povT60chRqY5xcYGVsaD6VaNIoBBmLfr6JtKtMEpdZKZu8EO6EYNXtm4a7SUrK98vReZNd8KWzFp+SGG3Btm1TfKORlOTbx8pVn/eTG8D2Hz0AAAmuFFirn2yUWrLu7Rp+k8F+bf8Puzv6NJkO214wPW9GRS0gnRCvze+/Ztn5iO6GKyWUg9xYwPbnrdLx8pVb2VZOQ5lYNqYOz67UnFF3FdZfakYXY3Aw6L3YvVHExoMyqFOSbtEvPbgkpGTEBNA3IFGOajEaGx/M2HUBX90wjvlDA4uhBP9pCkXpITTMwhmjZvEf7PAVn4FIEkHkG5z6TuD/2faw0e3ur66Qkdj3pi2o74Op56HsaTX0wg9vbJSY36yUaJn3Nav/+tjKg3bVfMJ477wPcf261Zycn6zJW1UAGg7+3HYqocUAP4sDyB4QcVDWSK1cvUb7Zj8+l+doLYItUiiTxw8ltXrXkzMNoCJ4EXvUns76c0nw2/zjZnD5ccKfaoLTOzogCNFzXMXGcvW2uti93ivGob/zj/yXoEzZF1mJYGnxJ80+M3SFr2DmN1zobFPyeFc4yK80yatCHEGs3JThU/mIzlXrAyA68w0KvASN8Epy1xp/rqrwiozGhE79r7LGELim/38iXDjRYiJxdDGmUWpMOjtW1pBxZ0jxBVhkarsaz4TcEPuwDiBsSoT5qZyrXuoHu64MDWfCRws5W+P31D8HDxM52fLOdTOAE2b8iUsl/fv/kyDYRDPT1Sw8yKvYFHFzrm9cyzivqwfNshalGr7VEuZja/Q1trhvV3mK8Xj1OBgw9nt4sVIZjzFdj6rr3mAAPNss3NKZsnWMreN5Ugb5In8GZ9mDm4SvDPtKJij7n0uVkTguip6ri2TTzSuuWoWifSfA2nSQ284otmjTbJqxFySoYca7OsPwfk3WdYmeb5WZ7wg/qmPrMGFiTTVYwHCwuTPDf/peIpUejA7eZw/tHK0cXe+Ep1zgRducy7O3hXLKde1gpPxJjo+Ya5WdajVDpXlRYysRZuwgi2OVIncN+bcO395HBXvv6dbQOfydxlm/QTo/IFy5PFX0SSXCDajLQ8RIItjyYiCjQtWaqgvLbpX1Eu7ph8RlUTjZxJxmh9vKidG/a0mJxmGIK0eC+0xV7Lfk3dKA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0741499-6413-48fe-9e5b-08da651450c1 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:55.5901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nn3mLrp+Qbfs8hi/E8rZLqIvYOkicnmEcwG9LlmwzNAAnD4zMwLOADpKqDS8wsJZfTuXHKr7fOKDAtoeLA4JwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The DW100 driver gets the dewarping mapping as a binary blob from the userspace application through a custom control. The blob format is hardware specific so create a dedicated control for this purpose. Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- .../userspace-api/media/drivers/dw100.rst | 15 +++++++++++++++ include/uapi/linux/dw100.h | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 include/uapi/linux/dw100.h diff --git a/Documentation/userspace-api/media/drivers/dw100.rst b/Documentation/userspace-api/media/drivers/dw100.rst index 1ca6fa55f539..fceea6ece622 100644 --- a/Documentation/userspace-api/media/drivers/dw100.rst +++ b/Documentation/userspace-api/media/drivers/dw100.rst @@ -66,4 +66,19 @@ map. More details on the DW100 hardware operations can be found in *chapter 13.15 DeWarp* of IMX8MP_ reference manual. +The Vivante DW100 m2m driver implements the following driver-specific control: + +``V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (__u32 array)`` + Specifies to DW100 driver its dewarping map (aka LUT) blob as described in + *chapter 13.15.2.3 Dewarping Remap* of IMX8MP_ reference manual as an U32 + dynamic array. The image is divided into many small 16x16 blocks. If the + width/height of the image is not divisible by 16, the size of the + rightmost/bottommost block is the remainder. The dewarping map only saves + the vertex coordinates of the block. The dewarping grid map is comprised of + vertex coordinates for x and y. Each x, y coordinate register uses 16 bits + (UQ12.4) to record the coordinate address, with the Y coordinate in the + upper bits and X in the lower bits. The driver modifies the dimensions of + this control when the sink format is changed, to reflect the new input + resolution. + .. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM diff --git a/include/uapi/linux/dw100.h b/include/uapi/linux/dw100.h new file mode 100644 index 000000000000..3356496edd6b --- /dev/null +++ b/include/uapi/linux/dw100.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* Copyright 2022 NXP */ + +#ifndef __UAPI_DW100_H__ +#define __UAPI_DW100_H__ + +#include + +/* + * Check Documentation/userspace-api/media/drivers/dw100.rst for control details. + */ +#define V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (V4L2_CID_USER_DW100_BASE + 1) + +#endif From patchwork Wed Jul 13 21:11:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917123 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 23D6FC43334 for ; Wed, 13 Jul 2022 21:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237356AbiGMVME (ORCPT ); Wed, 13 Jul 2022 17:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237347AbiGMVMA (ORCPT ); Wed, 13 Jul 2022 17:12:00 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB5B33412; Wed, 13 Jul 2022 14:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdBpo7kxgVtlxlxf07c+5sFu6ydyRLckrfZ40dmwyEnA/uVxv2d7y8NpU/nRgdQQtVEoWbDVc4EyPckB1vrVeAnVcgOhuxjH0sIhwGsWY/2LvHwtMkE4Rf0I8po71ojftWZ/H1TZQMb3AbqPh5SfvSC+5Myo05TLB1xjqnit/VUTL4XHpwmHXRoCNJmo0QjCmeBPQTXRAdISJWzCdrxfoqMdA/U4jJsPLPAfi9HPeC7F11LXkVSQmCTnDDNevPzSoa9P+JuOk4OtnxH0j1ea2VjOGTAc0l0l3DjhuCYk/L7znIOAT89YwvczGAmaGdTJIxVqdZ6HiMXD5FEotcSfAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sMkngJh0bpkLUQJek7tkMX0t7mASgAcmSByCfPSzdF8=; b=ZJXlWtZ7Ol68J1fiiTbCZsfIxhOrHLzrFbB+KuGM400GHR8iCKgj1x077em0dzq/uIeaQguVNtKBzvPd/6oN3zpjXXVbGDNmfnU/ipvCoT29tkNqpLKHFtckIpd6BCS5kBRqkclppYV+kPL3kw3QG9Jr3dntjWcyhhjeBc2g37cFlW+RilBIMiDVefbRDanWGcLgZ5OwVcRIZBTcMWitD2CQ9iY+lOcBYwng3UX6lV/iSXL1fHjlBmB05LtyW1NfsNT0N/MIdlaj1hLj1w8UiT6TIqEiHw225FuF81qExtEFa2E/SAa/rTGj7wnQTTAXCVSdshYcPgl+KVdjosBkLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sMkngJh0bpkLUQJek7tkMX0t7mASgAcmSByCfPSzdF8=; b=UnUwZtZKTk27WvQ7296FgRAdWzX6e2KrAufDUN5OP8WVj19UMBRPxcAA+8NI5s/wQFtBOR/euky2HaPPk0Lg5fGIo7vUrMle0CK4CAZfaFAo9zo5OX5NcOYqlV0jUCBvL2IlEAW3AW6mk2SUfDVkbFL8dOHGCMWVJia2jZvWrN0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:56 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:56 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v7 4/6] media: dt-bindings: media: Add i.MX8MP DW100 binding Date: Wed, 13 Jul 2022 23:11:22 +0200 Message-Id: <20220713211124.2677275-5-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71e90b25-f7cf-4169-aad3-08da65145112 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4a51LlZnFdC8YB8vB5+sK7ISfB0a6rSdQYaA6aecHnDoUIujXPaiXhsz8vmTWG1HoUGnv3K/tDq5hdUydoN07b0JRbcvJtCAw0hL15IjVelWW29X4B+L3X+ZMqNHjMLTy/8kbHAvG8hucFuCmd7mBQIRHDp+7Sy+gzpj7qzwg5yPy422m+vTSXAMX19FC02LIYT3YUBrhRSdEU2g+aub7pMjANUSsjEAkza0ZN3hVLfj+gve/RHu1kxbu0jNPx+q7muGmPt007d7xtYbb7R/59aGnBvE2u7wLurd+vCvjbaVEz/ZFW0G7I3HcsfeQqCBHeKTa0jtdTjmZ7OUA7oTuogVc5ENrGiiqum4CQ2E4EeaEVyhHMrJe69Xow77PnTi0zUy8dyggfo7zUQ5oM77KXVQHLUWdTe3i65ec2W3rccbUx7/UsnlrUAwnOdYTYnW7UeAW5yG5OMLywKCjvgaQVdSkA4pht1ad7jE4WGev+EJZ01XECMQ8+AzjH3oYyDqhWNF4yxfO1yVG+jZmhNSqj2TOxM3cGwFmaskoBsnYVSh035XwCdHK3RAJYVNr9NOdQUHhFFlo6Ifdqj1AvBvK6lQS+JvXDA1KQVPLfoUEYMIHcdTjnCEw3op/s5w0yESNbnArZu1HoFF9mihEL21cSA/FJcgOuk53paJeYEyScz6UH69Sa2QV0jljvryd+HWQNVf/Ha6JXnZV4kjI53aRouDM8pc+hhe6kaRh9/807u4ZVKns+kKyvkiaIvD0W+wVfACSuSa/EZ3OysvlF3qn2Br1oLlVqz0ZMo58Wm1LU1x1imfnJjKuxzq3qsXXRFGEfCXgNfqkk0LcMVg8ODy2Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(186003)(83380400001)(5660300002)(2906002)(6486002)(6666004)(966005)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(54906003)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vvkS/dIeaoKSmJYV78RanV832BL9RjVuDbbypVip+Qldufa8s3+V/kCri2nLgTU/8rpF+bBYDfLZCwU4FTICwxaJ9R34zurrkkNfg/0A5g6UqJjHRhlbEyOGEgukA2te8ww/Eoc1/6YU5hpsps60zomaWavzh48BGsLjLAW+S8EtN29/yJ6k37WvkX6NTrh/fkboLUxiXerqk/TSm9k3tYkKKnI/XVqASDur1R5rfEwqf6u/I6ObAttHhQqkXdmh4VG3laxDIk86vYwKED5qZalARI2lm7JoGIthrez0wa4D8umvSlJICVuYHdi22FfY7sW0xRVd0pmPlm6qxMbW5O2TThED5fbBDZv4dQaOf96O9JMI3HmlVCN77bGEOCOz6fFM72p1z318/C4ulkpUyDGMK6EEDndSe/KSQG1Vb1pqe7L69LkETbeGBPnzUWG5RbtxjyxNcAMbGs97o6lPg7rpD8KdfKye9+5kGsIxkstqMZzve1rvVVeeLUY2XnLfQvBGdujDKi28pQPePFouQgHkE1sWi6l/ILdN2TSV7zjRGJ03hwHYNxp0MZIdE0iBytihUSmgIvldvvIiSwaBzk/Ekv/Fwz+SfsGCzZ8TyUA2KYdpl1B5fpOmZ9YjEEl8JbQtJc7PBNKcmXvViV4N4+odS485hmdSfGOAvAzGUBC1xq9IcXn6g4+uxD3LGEiHM8ydAdJKbcogVP0YY+TXwMp7eF6XZ829Yq1AKkDFR5yI8m/lReaNEgQJmkODoRU55jqWDxyZshvflh8ZOkyHbeM5LrZOkKXADpXK7W2d8RG0arClD+CMkNn9O1VSQf9j2EbhQMG1sB8jwaLF57MsLihzqG5A485tAdAt/qmVub7qO5emfhks8OJTkpp2UPzCH9jaSS90ekBVgsl+AcW1vyw8jVpQjB5GSnMfC/tS7VbnDJ/BZcGcT6O+XsbcPZyg1KxKkFsmjouJcp9ejDVJYNErkicuEl4hKUaX6cCIhz/6sksfv0uiVZXv7RkcHokQ7/CWefwdPiQkYh35BKNrjzP3YcQW2g2r4xca1TH/GrjPGXYkUF+I3VvYsdnzuQM0t4YXg+9ZZl9ZgTiDrlD/250bZ6sw0wdFvjS4hQ1RCWRveaD3q2093UBUA6McBT20uOwnvwzgGBHQVpuzkPkHU9q4Ja8TEZxnlrbu3BaF28RtqrLbzeH2+s36QYx1Rrfj6FMurQpQxogedD/5kULY2p/iSbPVwh7nwGIDW8drz71I0XO4f39iBT4RMNmdH/WEXIGCXUtyU3fZ+UmcZY396FgYvRE3lM3HkzMkdqXsX+Eso/vLNbtzyqCxLssKbj5puLJCj2ULqThlQGqWTrWZKVoUQmtElJsHBRKMVr+2HLQutSEUKRif8ml30vpzfQEDzUb9ccBIXfqfES5IJ3BVlnnNvhKdtl61gUMK70Cd9Mlp1SN7evP/YP0COiHn0RmzsmpwHjnoLL68+K3hf1ts98KPFqDL8QQD5OvUpU7RctvdUVvD3G2UbjEP30W+YB0PU7j9AHHIqZKaDqI4eOk0ORmM2/pokdwUcVTXhsUXRJCCmgOMCBFKqqk4l0y8l0iYIgt83b1hK4+Hh5a55R87M3nVTeWLTGQpOI7OKfM0GXrzwgCssU6GALdJaOIgYzah93+Edz7nvyNkWUjfyjP/jw== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71e90b25-f7cf-4169-aad3-08da65145112 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:56.1682 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6mcxIIKbGwqZkmpsB1h2JImgR7B3LKtwXpSwScLL2E/Odlwz4sWkxeJCGOhtxIbPesVBDVyr3utB3Wnm7Dd+pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add DT binding documentation for the Vivante DW100 dewarper engine found on NXP i.MX8MP SoC Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart Reviewed-by: Rob Herring --- .../devicetree/bindings/media/nxp,dw100.yaml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/nxp,dw100.yaml diff --git a/Documentation/devicetree/bindings/media/nxp,dw100.yaml b/Documentation/devicetree/bindings/media/nxp,dw100.yaml new file mode 100644 index 000000000000..21910ff0e1c3 --- /dev/null +++ b/Documentation/devicetree/bindings/media/nxp,dw100.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/nxp,dw100.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP i.MX8MP DW100 Dewarper core + +maintainers: + - Xavier Roumegue + +description: |- + The Dewarp Engine provides high-performance dewarp processing for the + correction of the distortion that is introduced in images produced by fisheye + and wide angle lenses. It is implemented with a line/tile-cache based + architecture. With configurable address mapping look up tables and per tile + processing, it successfully generates a corrected output image. + The engine can be used to perform scaling, cropping and pixel format + conversion. + +properties: + compatible: + enum: + - nxp,imx8mp-dw100 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: The AXI clock + - description: The AHB clock + + clock-names: + items: + - const: axi + - const: ahb + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + #include + + dewarp: dwe@32e30000 { + compatible = "nxp,imx8mp-dw100"; + reg = <0x32e30000 0x10000>; + interrupts = ; + clocks = <&clk IMX8MP_CLK_MEDIA_AXI_ROOT>, + <&clk IMX8MP_CLK_MEDIA_APB_ROOT>; + clock-names = "axi", "ahb"; + power-domains = <&media_blk_ctrl IMX8MP_MEDIABLK_PD_DWE>; + }; From patchwork Wed Jul 13 21:11:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917125 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 15914CCA47C for ; Wed, 13 Jul 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237362AbiGMVMH (ORCPT ); Wed, 13 Jul 2022 17:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237358AbiGMVME (ORCPT ); Wed, 13 Jul 2022 17:12:04 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AA9A33416; Wed, 13 Jul 2022 14:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeR/UQywlakH+VB4iWUle9+uq6kEsudFNo8q1RKPcmGC2TLle1McMknISesVgYlWQDkQxiWbSPClpcg42lFcnN3zmkqk1r/oyKugsRYW76fyMc1tYfZNA/JVSAixf1iutX7vyrA0SAdJ0mx6nbudyrEaHbkfNHZbkhgV+W/Uffijzuk3wE2bIICN7KsD67wgFI0t2G8MwrrC5tUBcmsa3PG/D0+/9KFBA87/IrtE0QAB9WRaN8Vm2BKpQXOOAxTdYz9p3G/yo0GJVcVoSIhP71mg1l9kwP098PxX9U4wbNo8DHKAqLDJAKYBBxJlCUoh8nJNbLedtp523zFGaIfOWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i7hv2+YLz7eKZ8lxRtvHitedlV60axKYfInu30pGMyo=; b=hXfTtUCS09sjSW2THB+6yT+AI4RO8QCVzfQB2VQZ7X6Ijp3YgBXs+qqbbFvV06JXoW5kWT9EG9xcyaiI+j6I10yt1PoPzxIkxVmG8AvfdWaJVuJk80uhveQWSi+oSChzJ8hgSFL1s7d6fKBP0j2AavBT87yTdXryUI86fYNFigf48Kr5NZEHs69t+9M6ty8cpseYvdrR+VknJRieGIejMQ+dkvCYbGTcNxUNIiYnOgFpK4LgMoOAOqjbEslrcoTBKw5vKUuJBztkgkF76OCvQd/nLlPwjql2G0Fsu7m6Zr5OixHFymDwvQIZwNQvmortIS6YBoR9isVz3ztiq3km2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i7hv2+YLz7eKZ8lxRtvHitedlV60axKYfInu30pGMyo=; b=iWxBIxdS/Q29Mwu0nzJK8jD0bd5pwzaUFnPEDQRp3lS2C8v0RAuIF/SbXPQGfOybPVn7ptW2TVBUiVmyVuGwIkeXfLnlqCrVz9sU5rXaTOjcX3yxjYXpC4+AX7CHk+pNs/ZTw/evARqv/TZv+1m6x/X381c4Xsp0ClHInrXi5ww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:56 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:56 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v7 5/6] media: dw100: Add i.MX8MP dw100 dewarper driver Date: Wed, 13 Jul 2022 23:11:23 +0200 Message-Id: <20220713211124.2677275-6-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eef7823e-2af2-49e5-b597-08da65145163 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ijzZEcRU/1wrWG/RTYvfhOdDUiTZlRun+9wWRjm/6bQsbG/ra5qrj4eBEUI+9smptvPNLbsS7o08TT1PFHmPucr8WbIDhaSx02szNhzRjF7ozdIq/Tqyg6/5epZunHAdresErObrZQTUij3QfvLgvBYFwv81qvUBMYxugnpUu/TFXvj5e/zuAIPZnN19tei09BQ/pM3XbR07bTs/bXYMAhmhaOd461LKXeoJ2+T6Fr9TzgeMSE6a8YPcfcLcxM/5F8XjZObvYaiwxRPJHwqPqmiatqBQXhd+ssYJpbQ3f/iVa3748/kCKj/WYxeV+On8KYJPeW9tQDSt2pjh/RJAYtvGRfbdz9WhiohwVxpw0zbx212tEhZvTy0nXZzTy0PgBxoLpLLB8RdrWJV3Lyyv9tGwoKEWU8/SDSXnQu5dc+u8jJMpc4Rb/SqYvegrfyPbbK2jeQFUBtlr0UWtuZ8XRVg4oNUU7S+6hPpB8Gmaxnv1cF6GnFetXk07EJalDixm3UgzU26Qqce/7pau3dlWt1IapPcH9Wu55+D1aEgnNtRhHtOjYmGGBG+YsoxbH7vgwSiN1Iz4ux4XrZzFyBTYiwzSy1KJa9uH7+xVkhKe8XeEAvJSfKhvNP8SFDIASX5+NggFJNlD5dQX3eRkAEYC4qW2pREI+HomOF7CFb2yxNgtLbtEB23jLkNaQgOk7PfRX123YF7BaqqNAFkzZlw1fwnMvCFvPKJFG4lNzOAEDnk4YQzuvS/0hfybpEtcL9TEqQMAtiFC1wSelNFqzIWOIw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(30864003)(186003)(83380400001)(5660300002)(2906002)(6486002)(6666004)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q0kyNCsowwi736K6UwHItjr/safkKGEG8rQ3nAQlPfH0CbPppBdwzo4h5262yWgCN9izWdvGaMnheAoTUhexZnHa2MMqW13JTF2Lqus2IXncvjvoC+8cy2xBJVrjmOjxccE0aRP3vW+QBX3q7s2KCyfg9QeY2QN8JtbrPVV+mmXrNboLgMvs3uYS4fT7BhgXxEdKmaNmXIn9iJdg6xVDIyiDlI5xnYkp5jBFVB/U+vx0o4wtHLmA1Z1zKtvB8JKR3q0xoIjaU6U/lEZTumR3P15PNqiYjAXs59Pn0pSvmG8UrpFkrOHpgS7jLd1env7AHLCjbGIndD8S3TlDq5gRrzlnO1QB8IDWYoMiLb9UN2S+QFS2P+hr6lvlHzKJot4MSI5O3GhlbcuhMLmA2yb+x/3KSjlZ+MEH7p5WgkzHRNEyC/67FVbNlqFccQ4olDkBqaN4u79CU17wS6ItXCRA6QNOqix4EHwqlMrZDpGvz7EXgdAJEj80CkZKTdC1qUAQ+Ox0bxKcpcp7vVEjru67Cz60+FhDnd8IjWsIvXWCQJlfdCe0yn1miiPSvpzOkOuhRlcjbG95kVt9gVyKwQEUfHbdcyo73dXYMqfCnF3iWRKT8HXw08K9Kr9duzUtUFXr6HQuD8Iar+o2XAnVFzmkuWJ8D1ux82zXtx1vOknO6ToeNgzld3J4gGBdcMg1hSTZ3dLNWy+MeTnqdBlee+DbCY80ZITQ5+IP89/SEfOpPYQURB5uaqB/qHIs35Z21dnEG0Ko0FmS83YaM7t1mmwaVdlJR+mA5fpf0TbvSITt/cz6wb9QOc3ViCVLo38xFePJrO2oXjC0F8q8n/7RALDLNfwfv+LhIHHTm5M9Wr4nAtlkpSuYtrzTcXPQ5+hHIOtzHoP1sV1D65YlzInGmhvK9MADy98wHsbukdwQ2epmVVn2tZMO9hk57QfLP1u3NcaPMULAjG2a0CQnOKVj5gdUFpAz3/Xsq/amAwDSAuhELl1vlEJ6SgB2UsH4Z8RUDQkjMBSPvrJJdhFMeHn+HMghvB+pVkG88IsILJflTxkobtDRnoZGn+qZ5HsEByaaz1etTls+SUs1srFdgz4dN3Etv5YNKkxq3fr0CXWg2CG7tlTMdggp3novPReTPwa9/9XcFgHQnrDuj5k8rtSdMsubwMuJ4vFMo8PBmgmipA/ZaC5A6oF+jvqpMIQ934LnVsszG/GYusblr0L46wk4Sd3Ps6AFRKl3PB4OR98eYwdi7/VCfSKy6AtSfBoRSXfEOCvl2tdTDSk8N5zpDuNNO77T2XfrsQ++jGQ+DNclJsYn394pWA+DstoLGSGAeU9MLD1t9Yxkh0N84kEB4fnVnqzfky92RmyDfI9SJ93eOSp0EIrILfM5tZ8rkX5t2GakISQ3jRTRDRhqaDsdRvwPDOJJDfeEuA97BP4g8/vcwu7I/USE+efMx5y0DNplTbNiqSypuePBOY6UBV0MdbJmYqyJ12mzCX3mjiQFA0sNEJo/Dq9MrIM5GIjoQkwYqOioU1TbIJ7OpgtGoH7OnXkQA3UKMPEm5a5DL1MKhgL3Q5+vwPNv4mGZvCjWzOk8c8VXVX7rtqxSjdABvGz7Ofjkn2pMbULmy5M1SSZ7W3PxpnqzJp7Wux5QnHdIIt6AncY8f2PEPFLokfDffo8/9/8LpSw1uw== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eef7823e-2af2-49e5-b597-08da65145163 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:56.7473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NNnIAzPomO87JEvUu69sOXrxynahBSpMyit9j8ZjcqezOZMhiKn9Bd6svbMtQGb6ISy/AkMFOnywQdNEKF77dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a V4L2 mem-to-mem driver for the Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC. The processor core applies a programmable geometrical transformation on input images to correct distorsion introduced by lenses. The transformation function is exposed as a grid map with 16x16 pixel macroblocks indexed using X, Y vertex coordinates. The dewarping map can be set from application through a dedicated v4l2 control. If not set or invalid, the driver computes an identity map prior to starting the processing engine. The driver supports scaling, cropping and pixel format conversion. Signed-off-by: Xavier Roumegue Reviewed-by: Ezequiel Garcia Reviewed-by: Laurent Pinchart --- drivers/media/platform/nxp/Kconfig | 1 + drivers/media/platform/nxp/Makefile | 1 + drivers/media/platform/nxp/dw100/Kconfig | 17 + drivers/media/platform/nxp/dw100/Makefile | 3 + drivers/media/platform/nxp/dw100/dw100.c | 1675 +++++++++++++++++ drivers/media/platform/nxp/dw100/dw100_regs.h | 117 ++ 6 files changed, 1814 insertions(+) create mode 100644 drivers/media/platform/nxp/dw100/Kconfig create mode 100644 drivers/media/platform/nxp/dw100/Makefile create mode 100644 drivers/media/platform/nxp/dw100/dw100.c create mode 100644 drivers/media/platform/nxp/dw100/dw100_regs.h diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig index 1ac0a6e91111..4c76656e353e 100644 --- a/drivers/media/platform/nxp/Kconfig +++ b/drivers/media/platform/nxp/Kconfig @@ -51,4 +51,5 @@ config VIDEO_MX2_EMMAPRP memory to memory. Operations include resizing and format conversion. +source "drivers/media/platform/nxp/dw100/Kconfig" source "drivers/media/platform/nxp/imx-jpeg/Kconfig" diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile index efc38c6578ce..22ba28ac6d63 100644 --- a/drivers/media/platform/nxp/Makefile +++ b/drivers/media/platform/nxp/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-y += dw100/ obj-y += imx-jpeg/ obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o diff --git a/drivers/media/platform/nxp/dw100/Kconfig b/drivers/media/platform/nxp/dw100/Kconfig new file mode 100644 index 000000000000..45e01baf3b27 --- /dev/null +++ b/drivers/media/platform/nxp/dw100/Kconfig @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_DW100 + tristate "NXP i.MX DW100 dewarper" + depends on V4L_MEM2MEM_DRIVERS + depends on VIDEO_DEV + depends on ARCH_MXC || COMPILE_TEST + select MEDIA_CONTROLLER + select V4L2_MEM2MEM_DEV + select VIDEOBUF2_DMA_CONTIG + help + DW100 is a memory-to-memory engine performing geometrical + transformation on source images through a programmable dewarping map. + + To compile this driver as a module, choose M here: the module + will be called dw100. + diff --git a/drivers/media/platform/nxp/dw100/Makefile b/drivers/media/platform/nxp/dw100/Makefile new file mode 100644 index 000000000000..49db80589e9a --- /dev/null +++ b/drivers/media/platform/nxp/dw100/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_VIDEO_DW100) += dw100.o diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c new file mode 100644 index 000000000000..6226afed9b05 --- /dev/null +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -0,0 +1,1675 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * DW100 Hardware dewarper + * + * Copyright 2022 NXP + * Author: Xavier Roumegue (xavier.roumegue@oss.nxp.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "dw100_regs.h" + +#define DRV_NAME "dw100" + +#define DW100_MIN_W 176u +#define DW100_MIN_H 144u +#define DW100_MAX_W 4096u +#define DW100_MAX_H 3072u +#define DW100_ALIGN_W 3 +#define DW100_ALIGN_H 3 + +#define DW100_BLOCK_SIZE 16 + +#define DW100_MAX_LUT_W (DIV_ROUND_UP(DW100_MAX_W, DW100_BLOCK_SIZE) + 1) +#define DW100_MIN_LUT_W (DIV_ROUND_UP(DW100_MIN_W, DW100_BLOCK_SIZE) + 1) +#define DW100_MAX_LUT_H (DIV_ROUND_UP(DW100_MAX_H, DW100_BLOCK_SIZE) + 1) +#define DW100_MIN_LUT_H (DIV_ROUND_UP(DW100_MIN_H, DW100_BLOCK_SIZE) + 1) +#define DW100_MAX_LUT_NELEMS (DW100_MAX_LUT_W * DW100_MAX_LUT_H) +#define DW100_MIN_LUT_NELEMS (DW100_MIN_LUT_W * DW100_MIN_LUT_H) + +/* + * 16 controls have been reserved for this driver for future extension, but + * let's limit the related driver allocation to the effective number of controls + * in use. + */ +#define DW100_MAX_CTRLS 1 +#define DW100_CTRL_DEWARPING_MAP 0 + +enum { + DW100_QUEUE_SRC = 0, + DW100_QUEUE_DST = 1, +}; + +enum { + DW100_FMT_CAPTURE = BIT(0), + DW100_FMT_OUTPUT = BIT(1), +}; + +struct dw100_device { + struct platform_device *pdev; + struct v4l2_m2m_dev *m2m_dev; + struct v4l2_device v4l2_dev; + struct video_device vfd; + struct media_device mdev; + /* Video device lock */ + struct mutex vfd_mutex; + void __iomem *mmio; + struct clk_bulk_data *clks; + int num_clks; + struct dentry *debugfs_root; +}; + +struct dw100_q_data { + struct v4l2_pix_format_mplane pix_fmt; + unsigned int sequence; + const struct dw100_fmt *fmt; + struct v4l2_rect crop; +}; + +struct dw100_ctx { + struct v4l2_fh fh; + struct dw100_device *dw_dev; + struct v4l2_ctrl_handler hdl; + struct v4l2_ctrl *ctrls[DW100_MAX_CTRLS]; + /* per context m2m queue lock */ + struct mutex vq_mutex; + + /* Look Up Table for pixel remapping */ + unsigned int *map; + dma_addr_t map_dma; + size_t map_size; + unsigned int map_width; + unsigned int map_height; + bool user_map_is_valid; + + /* Related colorspace properties propagated from input to output */ + enum v4l2_colorspace colorspace; + enum v4l2_xfer_func xfer_func; + enum v4l2_ycbcr_encoding ycbcr_enc; + enum v4l2_quantization quant; + + /* Source and destination queue data */ + struct dw100_q_data q_data[2]; +}; + +static const struct v4l2_frmsize_stepwise dw100_frmsize_stepwise = { + .min_width = DW100_MIN_W, + .min_height = DW100_MIN_H, + .max_width = DW100_MAX_W, + .max_height = DW100_MAX_H, + .step_width = 1UL << DW100_ALIGN_W, + .step_height = 1UL << DW100_ALIGN_H, +}; + +static const struct dw100_fmt { + u32 fourcc; + u32 types; + u32 reg_format; + bool reg_swap_uv; +} formats[] = { + { + .fourcc = V4L2_PIX_FMT_NV16, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP, + .reg_swap_uv = false, + }, { + .fourcc = V4L2_PIX_FMT_NV16M, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP, + .reg_swap_uv = false, + }, { + .fourcc = V4L2_PIX_FMT_NV61, + .types = DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP, + .reg_swap_uv = true, + }, { + .fourcc = V4L2_PIX_FMT_NV61M, + .types = DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP, + .reg_swap_uv = true, + }, { + .fourcc = V4L2_PIX_FMT_YUYV, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED, + .reg_swap_uv = false, + }, { + .fourcc = V4L2_PIX_FMT_UYVY, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED, + .reg_swap_uv = true, + }, { + .fourcc = V4L2_PIX_FMT_NV12, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV420_SP, + .reg_swap_uv = false, + }, { + .fourcc = V4L2_PIX_FMT_NV12M, + .types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV420_SP, + .reg_swap_uv = false, + }, { + .fourcc = V4L2_PIX_FMT_NV21, + .types = DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV420_SP, + .reg_swap_uv = true, + }, { + .fourcc = V4L2_PIX_FMT_NV21M, + .types = DW100_FMT_CAPTURE, + .reg_format = DW100_DEWARP_CTRL_FORMAT_YUV420_SP, + .reg_swap_uv = true, + }, +}; + +static inline int to_dw100_fmt_type(enum v4l2_buf_type type) +{ + if (V4L2_TYPE_IS_OUTPUT(type)) + return DW100_FMT_OUTPUT; + else + return DW100_FMT_CAPTURE; +} + +static const struct dw100_fmt *dw100_find_pixel_format(u32 pixel_format, + int fmt_type) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(formats); i++) { + const struct dw100_fmt *fmt = &formats[i]; + + if (fmt->fourcc == pixel_format && fmt->types & fmt_type) + return fmt; + } + + return NULL; +} + +static const struct dw100_fmt *dw100_find_format(struct v4l2_format *f) +{ + return dw100_find_pixel_format(f->fmt.pix_mp.pixelformat, + to_dw100_fmt_type(f->type)); +} + +static inline u32 dw100_read(struct dw100_device *dw_dev, u32 reg) +{ + return readl(dw_dev->mmio + reg); +} + +static inline void dw100_write(struct dw100_device *dw_dev, u32 reg, u32 val) +{ + writel(val, dw_dev->mmio + reg); +} + +static inline int dw100_dump_regs(struct seq_file *m) +{ + struct dw100_device *dw_dev = m->private; +#define __DECLARE_REG(x) { #x, x } + unsigned int i; + static const struct reg_desc { + const char * const name; + unsigned int addr; + } dw100_regs[] = { + __DECLARE_REG(DW100_DEWARP_ID), + __DECLARE_REG(DW100_DEWARP_CTRL), + __DECLARE_REG(DW100_MAP_LUT_ADDR), + __DECLARE_REG(DW100_MAP_LUT_SIZE), + __DECLARE_REG(DW100_MAP_LUT_ADDR2), + __DECLARE_REG(DW100_MAP_LUT_SIZE2), + __DECLARE_REG(DW100_SRC_IMG_Y_BASE), + __DECLARE_REG(DW100_SRC_IMG_UV_BASE), + __DECLARE_REG(DW100_SRC_IMG_SIZE), + __DECLARE_REG(DW100_SRC_IMG_STRIDE), + __DECLARE_REG(DW100_DST_IMG_Y_BASE), + __DECLARE_REG(DW100_DST_IMG_UV_BASE), + __DECLARE_REG(DW100_DST_IMG_SIZE), + __DECLARE_REG(DW100_DST_IMG_STRIDE), + __DECLARE_REG(DW100_DST_IMG_Y_SIZE1), + __DECLARE_REG(DW100_DST_IMG_UV_SIZE1), + __DECLARE_REG(DW100_SRC_IMG_Y_BASE2), + __DECLARE_REG(DW100_SRC_IMG_UV_BASE2), + __DECLARE_REG(DW100_SRC_IMG_SIZE2), + __DECLARE_REG(DW100_SRC_IMG_STRIDE2), + __DECLARE_REG(DW100_DST_IMG_Y_BASE2), + __DECLARE_REG(DW100_DST_IMG_UV_BASE2), + __DECLARE_REG(DW100_DST_IMG_SIZE2), + __DECLARE_REG(DW100_DST_IMG_STRIDE2), + __DECLARE_REG(DW100_DST_IMG_Y_SIZE2), + __DECLARE_REG(DW100_DST_IMG_UV_SIZE2), + __DECLARE_REG(DW100_SWAP_CONTROL), + __DECLARE_REG(DW100_VERTICAL_SPLIT_LINE), + __DECLARE_REG(DW100_HORIZON_SPLIT_LINE), + __DECLARE_REG(DW100_SCALE_FACTOR), + __DECLARE_REG(DW100_ROI_START), + __DECLARE_REG(DW100_BOUNDARY_PIXEL), + __DECLARE_REG(DW100_INTERRUPT_STATUS), + __DECLARE_REG(DW100_BUS_CTRL), + __DECLARE_REG(DW100_BUS_CTRL1), + __DECLARE_REG(DW100_BUS_TIME_OUT_CYCLE), + }; + + for (i = 0; i < ARRAY_SIZE(dw100_regs); i++) + seq_printf(m, "%s: %#x\n", dw100_regs[i].name, + dw100_read(dw_dev, dw100_regs[i].addr)); + + return 0; +} + +static inline struct dw100_ctx *dw100_file2ctx(struct file *file) +{ + return container_of(file->private_data, struct dw100_ctx, fh); +} + +static struct dw100_q_data *dw100_get_q_data(struct dw100_ctx *ctx, + enum v4l2_buf_type type) +{ + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + return &ctx->q_data[DW100_QUEUE_SRC]; + else + return &ctx->q_data[DW100_QUEUE_DST]; +} + +static u32 dw100_get_n_vertices_from_length(u32 length) +{ + return DIV_ROUND_UP(length, DW100_BLOCK_SIZE) + 1; +} + +static u16 dw100_map_convert_to_uq12_4(u32 a) +{ + return (u16)((a & 0xfff) << 4); +} + +static u32 dw100_map_format_coordinates(u16 xq, u16 yq) +{ + return (u32)((yq << 16) | xq); +} + +static u32 *dw100_get_user_map(struct dw100_ctx *ctx) +{ + struct v4l2_ctrl *ctrl = ctx->ctrls[DW100_CTRL_DEWARPING_MAP]; + + if (!ctx->user_map_is_valid) + return NULL; + + return ctrl->p_cur.p_u32; +} + +/* + * Create the dewarp map from the V4L2 control. If the control hasn't been set + * by the application, generate an identity mapping. + * + * A 16 pixels cell size grid is mapped on the destination image. + * The last cells width/height might be lesser than 16 if the destination image + * width/height is not divisible by 16. This dewarping grid map specifies the + * source image pixel location (x, y) on each grid intersection point. + * Bilinear interpolation is used to compute inner cell points locations. + * + * The coordinates are saved in UQ12.4 fixed point format. + */ +static int dw100_create_mapping(struct dw100_ctx *ctx) +{ + u32 sw, sh, dw, dh, mw, mh, i, j; + u16 qx, qy, qdx, qdy, qsh, qsw; + bool is_user_map = false; + u32 *user_map, *map; + + sw = ctx->q_data[DW100_QUEUE_SRC].pix_fmt.width; + dw = ctx->q_data[DW100_QUEUE_DST].pix_fmt.width; + sh = ctx->q_data[DW100_QUEUE_SRC].pix_fmt.height; + dh = ctx->q_data[DW100_QUEUE_DST].pix_fmt.height; + + mw = dw100_get_n_vertices_from_length(dw); + mh = dw100_get_n_vertices_from_length(dh); + + qsw = dw100_map_convert_to_uq12_4(sw); + qsh = dw100_map_convert_to_uq12_4(sh); + qdx = qsw / (mw - 1); + qdy = qsh / (mh - 1); + + if (ctx->map) + dma_free_coherent(&ctx->dw_dev->pdev->dev, ctx->map_size, + ctx->map, ctx->map_dma); + + ctx->map_width = mw; + ctx->map_height = mh; + ctx->map_size = mh * mw * sizeof(u32); + + ctx->map = dma_alloc_coherent(&ctx->dw_dev->pdev->dev, ctx->map_size, + &ctx->map_dma, GFP_KERNEL); + + if (!ctx->map) + return -ENOMEM; + + user_map = dw100_get_user_map(ctx); + if (user_map) { + is_user_map = true; + memcpy(ctx->map, user_map, ctx->map_size); + goto out; + } + + map = ctx->map; + for (i = 0, qy = 0; i < mh; i++, qy += qdy) { + if (qy > qsh) + qy = qsh; + for (j = 0, qx = 0; j < mw; j++, qx += qdx) { + if (qx > qsw) + qx = qsw; + *map++ = dw100_map_format_coordinates(qx, qy); + } + } + +out: + dev_dbg(&ctx->dw_dev->pdev->dev, + "%ux%u %s mapping created (d:%pad-c:%p) for stream %ux%u->%ux%u\n", + mw, mh, is_user_map ? "user" : "identity", + &ctx->map_dma, ctx->map, sw, sh, dw, dh); + + return 0; +} + +static void dw100_destroy_mapping(struct dw100_ctx *ctx) +{ + if (ctx->map) { + dma_free_coherent(&ctx->dw_dev->pdev->dev, ctx->map_size, + ctx->map, ctx->map_dma); + ctx->map = NULL; + } +} + +static int dw100_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct dw100_ctx *ctx = + container_of(ctrl->handler, struct dw100_ctx, hdl); + + switch (ctrl->id) { + case V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP: + ctx->user_map_is_valid = true; + break; + } + + return 0; +} + +static const struct v4l2_ctrl_ops dw100_ctrl_ops = { + .s_ctrl = dw100_s_ctrl, +}; + +static const struct v4l2_ctrl_config controls[] = { + [DW100_CTRL_DEWARPING_MAP] = { + .ops = &dw100_ctrl_ops, + .id = V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP, + .name = "Look-Up Table", + .type = V4L2_CTRL_TYPE_U32, + .min = 0x00000000, + .max = 0xffffffff, + .step = 1, + .def = 0, + .dims = { DW100_MAX_LUT_W, DW100_MAX_LUT_H }, + }, +}; + +static int dw100_queue_setup(struct vb2_queue *vq, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], struct device *alloc_devs[]) +{ + struct dw100_ctx *ctx = vb2_get_drv_priv(vq); + const struct v4l2_pix_format_mplane *format; + unsigned int i; + + format = &dw100_get_q_data(ctx, vq->type)->pix_fmt; + + if (*nplanes) { + if (*nplanes != format->num_planes) + return -EINVAL; + + for (i = 0; i < *nplanes; ++i) { + if (sizes[i] < format->plane_fmt[i].sizeimage) + return -EINVAL; + } + + return 0; + } + + *nplanes = format->num_planes; + + for (i = 0; i < format->num_planes; ++i) + sizes[i] = format->plane_fmt[i].sizeimage; + + return 0; +} + +static int dw100_buf_prepare(struct vb2_buffer *vb) +{ + unsigned int i; + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct dw100_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); + struct dw100_device *dw_dev = ctx->dw_dev; + const struct v4l2_pix_format_mplane *pix_fmt = + &dw100_get_q_data(ctx, vb->vb2_queue->type)->pix_fmt; + + if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) { + if (vbuf->field != V4L2_FIELD_NONE) { + dev_dbg(&dw_dev->pdev->dev, "%x field isn't supported\n", + vbuf->field); + return -EINVAL; + } + } + + for (i = 0; i < pix_fmt->num_planes; i++) { + unsigned long size = pix_fmt->plane_fmt[i].sizeimage; + + if (vb2_plane_size(vb, i) < size) { + dev_dbg(&dw_dev->pdev->dev, + "User buffer too small (%lu < %lu)\n", + vb2_plane_size(vb, i), size); + return -EINVAL; + } + + vb2_set_plane_payload(vb, i, size); + } + + return 0; +} + +static void dw100_buf_queue(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct dw100_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); + + v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); +} + +static int dw100_start_streaming(struct vb2_queue *q, unsigned int count) +{ + struct dw100_ctx *ctx = vb2_get_drv_priv(q); + struct dw100_q_data *q_data = dw100_get_q_data(ctx, q->type); + int ret; + + q_data->sequence = 0; + + ret = dw100_create_mapping(ctx); + if (ret) + return ret; + + return pm_runtime_resume_and_get(&ctx->dw_dev->pdev->dev); +} + +static void dw100_stop_streaming(struct vb2_queue *q) +{ + struct dw100_ctx *ctx = vb2_get_drv_priv(q); + struct vb2_v4l2_buffer *vbuf; + + for (;;) { + if (V4L2_TYPE_IS_OUTPUT(q->type)) + vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + else + vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + if (!vbuf) + break; + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); + } + + pm_runtime_put_sync(&ctx->dw_dev->pdev->dev); + + dw100_destroy_mapping(ctx); +} + +static const struct vb2_ops dw100_qops = { + .queue_setup = dw100_queue_setup, + .buf_prepare = dw100_buf_prepare, + .buf_queue = dw100_buf_queue, + .start_streaming = dw100_start_streaming, + .stop_streaming = dw100_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +static int dw100_m2m_queue_init(void *priv, struct vb2_queue *src_vq, + struct vb2_queue *dst_vq) +{ + struct dw100_ctx *ctx = priv; + int ret; + + src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + src_vq->io_modes = VB2_MMAP | VB2_DMABUF; + src_vq->drv_priv = ctx; + src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); + src_vq->ops = &dw100_qops; + src_vq->mem_ops = &vb2_dma_contig_memops; + src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; + src_vq->lock = &ctx->vq_mutex; + src_vq->dev = ctx->dw_dev->v4l2_dev.dev; + + ret = vb2_queue_init(src_vq); + if (ret) + return ret; + + dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + dst_vq->io_modes = VB2_MMAP | VB2_DMABUF; + dst_vq->drv_priv = ctx; + dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); + dst_vq->ops = &dw100_qops; + dst_vq->mem_ops = &vb2_dma_contig_memops; + dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; + dst_vq->lock = &ctx->vq_mutex; + dst_vq->dev = ctx->dw_dev->v4l2_dev.dev; + + return vb2_queue_init(dst_vq); +} + +static int dw100_open(struct file *file) +{ + struct dw100_device *dw_dev = video_drvdata(file); + struct dw100_ctx *ctx; + struct v4l2_ctrl_handler *hdl; + struct v4l2_pix_format_mplane *pix_fmt; + int ret, i; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + mutex_init(&ctx->vq_mutex); + v4l2_fh_init(&ctx->fh, video_devdata(file)); + file->private_data = &ctx->fh; + ctx->dw_dev = dw_dev; + + hdl = &ctx->hdl; + v4l2_ctrl_handler_init(hdl, ARRAY_SIZE(controls)); + for (i = 0; i < ARRAY_SIZE(controls); i++) { + ctx->ctrls[i] = v4l2_ctrl_new_custom(hdl, &controls[i], NULL); + if (hdl->error) { + dev_err(&ctx->dw_dev->pdev->dev, + "Adding control (%d) failed\n", i); + ret = hdl->error; + goto err; + } + } + ctx->fh.ctrl_handler = hdl; + ctx->user_map_is_valid = false; + + ctx->q_data[DW100_QUEUE_SRC].fmt = &formats[0]; + + pix_fmt = &ctx->q_data[DW100_QUEUE_SRC].pix_fmt; + pix_fmt->field = V4L2_FIELD_NONE; + pix_fmt->colorspace = V4L2_COLORSPACE_REC709; + pix_fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(pix_fmt->colorspace); + pix_fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(pix_fmt->colorspace); + pix_fmt->quantization = + V4L2_MAP_QUANTIZATION_DEFAULT(false, pix_fmt->colorspace, + pix_fmt->ycbcr_enc); + + v4l2_fill_pixfmt_mp(pix_fmt, formats[0].fourcc, 640, 480); + + ctx->q_data[DW100_QUEUE_SRC].crop.top = 0; + ctx->q_data[DW100_QUEUE_SRC].crop.left = 0; + ctx->q_data[DW100_QUEUE_SRC].crop.width = 640; + ctx->q_data[DW100_QUEUE_SRC].crop.height = 480; + + ctx->q_data[DW100_QUEUE_DST] = ctx->q_data[DW100_QUEUE_SRC]; + + ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dw_dev->m2m_dev, + ctx, &dw100_m2m_queue_init); + + if (IS_ERR(ctx->fh.m2m_ctx)) { + ret = PTR_ERR(ctx->fh.m2m_ctx); + goto err; + } + + v4l2_fh_add(&ctx->fh); + + return 0; + +err: + v4l2_ctrl_handler_free(hdl); + v4l2_fh_exit(&ctx->fh); + mutex_destroy(&ctx->vq_mutex); + kfree(ctx); + + return ret; +} + +static int dw100_release(struct file *file) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + + v4l2_fh_del(&ctx->fh); + v4l2_fh_exit(&ctx->fh); + v4l2_ctrl_handler_free(&ctx->hdl); + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); + mutex_destroy(&ctx->vq_mutex); + kfree(ctx); + + return 0; +} + +static const struct v4l2_file_operations dw100_fops = { + .owner = THIS_MODULE, + .open = dw100_open, + .release = dw100_release, + .poll = v4l2_m2m_fop_poll, + .unlocked_ioctl = video_ioctl2, + .mmap = v4l2_m2m_fop_mmap, +}; + +static int dw100_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + strscpy(cap->driver, DRV_NAME, sizeof(cap->driver)); + strscpy(cap->card, "DW100 dewarper", sizeof(cap->card)); + + return 0; +} + +static int dw100_enum_fmt_vid(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + int i, num = 0; + + for (i = 0; i < ARRAY_SIZE(formats); i++) { + if (formats[i].types & to_dw100_fmt_type(f->type)) { + if (num == f->index) { + f->pixelformat = formats[i].fourcc; + return 0; + } + ++num; + } + } + + return -EINVAL; +} + +static int dw100_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *fsize) +{ + const struct dw100_fmt *fmt; + + if (fsize->index) + return -EINVAL; + + fmt = dw100_find_pixel_format(fsize->pixel_format, + DW100_FMT_OUTPUT | DW100_FMT_CAPTURE); + if (!fmt) + return -EINVAL; + + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; + fsize->stepwise = dw100_frmsize_stepwise; + + return 0; +} + +static int dw100_g_fmt_vid(struct file *file, void *priv, struct v4l2_format *f) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + struct vb2_queue *vq; + struct dw100_q_data *q_data; + + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); + if (!vq) + return -EINVAL; + + q_data = dw100_get_q_data(ctx, f->type); + + f->fmt.pix_mp = q_data->pix_fmt; + + return 0; +} + +static int dw100_try_fmt(struct v4l2_format *f) +{ + struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp; + const struct dw100_fmt *fmt; + + fmt = dw100_find_format(f); + if (!fmt) { + f->fmt.pix_mp.pixelformat = formats[0].fourcc; + fmt = dw100_find_format(f); + } + + v4l2_apply_frmsize_constraints(&pix->width, &pix->height, + &dw100_frmsize_stepwise); + + v4l2_fill_pixfmt_mp(pix, fmt->fourcc, pix->width, pix->height); + + pix->field = V4L2_FIELD_NONE; + + if (pix->colorspace == V4L2_COLORSPACE_DEFAULT) + pix->colorspace = V4L2_COLORSPACE_REC709; + if (pix->xfer_func == V4L2_XFER_FUNC_DEFAULT) + pix->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(pix->colorspace); + if (pix->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT) + pix->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(pix->colorspace); + if (pix->quantization == V4L2_QUANTIZATION_DEFAULT) + pix->quantization = + V4L2_MAP_QUANTIZATION_DEFAULT(false, pix->colorspace, + pix->ycbcr_enc); + + return 0; +} + +static int dw100_s_fmt(struct dw100_ctx *ctx, struct v4l2_format *f) +{ + struct dw100_q_data *q_data; + struct vb2_queue *vq; + + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); + if (!vq) + return -EINVAL; + + q_data = dw100_get_q_data(ctx, f->type); + if (!q_data) + return -EINVAL; + + if (vb2_is_busy(vq)) { + dev_dbg(&ctx->dw_dev->pdev->dev, "%s queue busy\n", __func__); + return -EBUSY; + } + + q_data->fmt = dw100_find_format(f); + q_data->pix_fmt = f->fmt.pix_mp; + q_data->crop.top = 0; + q_data->crop.left = 0; + q_data->crop.width = f->fmt.pix_mp.width; + q_data->crop.height = f->fmt.pix_mp.height; + + /* Propagate buffers encoding */ + + if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + struct dw100_q_data *dst_q_data = + dw100_get_q_data(ctx, + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + + dst_q_data->pix_fmt.colorspace = q_data->pix_fmt.colorspace; + dst_q_data->pix_fmt.ycbcr_enc = q_data->pix_fmt.ycbcr_enc; + dst_q_data->pix_fmt.quantization = q_data->pix_fmt.quantization; + dst_q_data->pix_fmt.xfer_func = q_data->pix_fmt.xfer_func; + } + + dev_dbg(&ctx->dw_dev->pdev->dev, + "Setting format for type %u, wxh: %ux%u, fmt: %u\n", + f->type, q_data->pix_fmt.width, q_data->pix_fmt.height, + q_data->pix_fmt.pixelformat); + + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + int ret; + u32 dims[V4L2_CTRL_MAX_DIMS] = {}; + struct v4l2_ctrl *ctrl = ctx->ctrls[DW100_CTRL_DEWARPING_MAP]; + + dims[0] = + dw100_get_n_vertices_from_length(q_data->pix_fmt.width); + dims[1] = + dw100_get_n_vertices_from_length(q_data->pix_fmt.height); + + v4l2_ctrl_lock(ctrl); + ctx->user_map_is_valid = false; + ret = __v4l2_ctrl_modify_dimensions(ctrl, dims); + v4l2_ctrl_unlock(ctrl); + + if (ret) { + dev_err(&ctx->dw_dev->pdev->dev, + "Modifying LUT dimensions failed with error %d\n", + ret); + return ret; + } + } + + return 0; +} + +static int dw100_try_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + return -EINVAL; + + return dw100_try_fmt(f); +} + +static int dw100_s_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + int ret; + + ret = dw100_try_fmt_vid_cap(file, priv, f); + if (ret) + return ret; + + ret = dw100_s_fmt(ctx, f); + if (ret) + return ret; + + return 0; +} + +static int dw100_try_fmt_vid_out(struct file *file, void *priv, + struct v4l2_format *f) +{ + if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + return -EINVAL; + + return dw100_try_fmt(f); +} + +static int dw100_s_fmt_vid_out(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + int ret; + + ret = dw100_try_fmt_vid_out(file, priv, f); + if (ret) + return ret; + + ret = dw100_s_fmt(ctx, f); + if (ret) + return ret; + + return 0; +} + +static int dw100_g_selection(struct file *file, void *fh, + struct v4l2_selection *sel) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + struct dw100_q_data *src_q_data; + + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + src_q_data = dw100_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.top = 0; + sel->r.left = 0; + sel->r.width = src_q_data->pix_fmt.width; + sel->r.height = src_q_data->pix_fmt.height; + break; + case V4L2_SEL_TGT_CROP: + sel->r.top = src_q_data->crop.top; + sel->r.left = src_q_data->crop.left; + sel->r.width = src_q_data->crop.width; + sel->r.height = src_q_data->crop.height; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int dw100_s_selection(struct file *file, void *fh, + struct v4l2_selection *sel) +{ + struct dw100_ctx *ctx = dw100_file2ctx(file); + struct dw100_q_data *src_q_data; + u32 qscalex, qscaley, qscale; + int x, y, w, h; + unsigned int wframe, hframe; + + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + src_q_data = dw100_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); + + dev_dbg(&ctx->dw_dev->pdev->dev, + ">>> Buffer Type: %u Target: %u Rect: %ux%u@%d.%d\n", + sel->type, sel->target, + sel->r.width, sel->r.height, sel->r.left, sel->r.top); + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + wframe = src_q_data->pix_fmt.width; + hframe = src_q_data->pix_fmt.height; + + sel->r.top = clamp_t(int, sel->r.top, 0, hframe - DW100_MIN_H); + sel->r.left = clamp_t(int, sel->r.left, 0, wframe - DW100_MIN_W); + sel->r.height = + clamp(sel->r.height, DW100_MIN_H, hframe - sel->r.top); + sel->r.width = + clamp(sel->r.width, DW100_MIN_W, wframe - sel->r.left); + + /* UQ16.16 for float operations */ + qscalex = (sel->r.width << 16) / wframe; + qscaley = (sel->r.height << 16) / hframe; + y = sel->r.top; + x = sel->r.left; + if (qscalex == qscaley) { + qscale = qscalex; + } else { + switch (sel->flags) { + case 0: + qscale = (qscalex + qscaley) / 2; + break; + case V4L2_SEL_FLAG_GE: + qscale = max(qscaley, qscalex); + break; + case V4L2_SEL_FLAG_LE: + qscale = min(qscaley, qscalex); + break; + case V4L2_SEL_FLAG_LE | V4L2_SEL_FLAG_GE: + return -ERANGE; + default: + return -EINVAL; + } + } + + w = (u32)((((u64)wframe << 16) * qscale) >> 32); + h = (u32)((((u64)hframe << 16) * qscale) >> 32); + x = x + (sel->r.width - w) / 2; + y = y + (sel->r.height - h) / 2; + x = min(wframe - w, (unsigned int)max(0, x)); + y = min(hframe - h, (unsigned int)max(0, y)); + + sel->r.top = y; + sel->r.left = x; + sel->r.width = w; + sel->r.height = h; + + src_q_data->crop.top = sel->r.top; + src_q_data->crop.left = sel->r.left; + src_q_data->crop.width = sel->r.width; + src_q_data->crop.height = sel->r.height; + break; + + default: + return -EINVAL; + } + + dev_dbg(&ctx->dw_dev->pdev->dev, + "<<< Buffer Type: %u Target: %u Rect: %ux%u@%d.%d\n", + sel->type, sel->target, + sel->r.width, sel->r.height, sel->r.left, sel->r.top); + + return 0; +} + +static const struct v4l2_ioctl_ops dw100_ioctl_ops = { + .vidioc_querycap = dw100_querycap, + + .vidioc_enum_fmt_vid_cap = dw100_enum_fmt_vid, + .vidioc_enum_framesizes = dw100_enum_framesizes, + .vidioc_g_fmt_vid_cap_mplane = dw100_g_fmt_vid, + .vidioc_try_fmt_vid_cap_mplane = dw100_try_fmt_vid_cap, + .vidioc_s_fmt_vid_cap_mplane = dw100_s_fmt_vid_cap, + + .vidioc_enum_fmt_vid_out = dw100_enum_fmt_vid, + .vidioc_g_fmt_vid_out_mplane = dw100_g_fmt_vid, + .vidioc_try_fmt_vid_out_mplane = dw100_try_fmt_vid_out, + .vidioc_s_fmt_vid_out_mplane = dw100_s_fmt_vid_out, + + .vidioc_g_selection = dw100_g_selection, + .vidioc_s_selection = dw100_s_selection, + .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, + .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, + .vidioc_qbuf = v4l2_m2m_ioctl_qbuf, + .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf, + .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, + .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, + .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, + + .vidioc_streamon = v4l2_m2m_ioctl_streamon, + .vidioc_streamoff = v4l2_m2m_ioctl_streamoff, + + .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, +}; + +static void dw100_job_finish(struct dw100_device *dw_dev, bool with_error) +{ + struct dw100_ctx *curr_ctx; + struct vb2_v4l2_buffer *src_vb, *dst_vb; + enum vb2_buffer_state buf_state; + + curr_ctx = v4l2_m2m_get_curr_priv(dw_dev->m2m_dev); + + if (!curr_ctx) { + dev_err(&dw_dev->pdev->dev, + "Instance released before the end of transaction\n"); + return; + } + + src_vb = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx); + dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx); + + if (likely(!with_error)) + buf_state = VB2_BUF_STATE_DONE; + else + buf_state = VB2_BUF_STATE_ERROR; + + v4l2_m2m_buf_done(src_vb, buf_state); + v4l2_m2m_buf_done(dst_vb, buf_state); + + dev_dbg(&dw_dev->pdev->dev, "Finishing transaction with%s error(s)\n", + with_error ? "" : "out"); + + v4l2_m2m_job_finish(dw_dev->m2m_dev, curr_ctx->fh.m2m_ctx); +} + +static void dw100_hw_reset(struct dw100_device *dw_dev) +{ + u32 val; + + val = dw100_read(dw_dev, DW100_DEWARP_CTRL); + val |= DW100_DEWARP_CTRL_ENABLE; + val |= DW100_DEWARP_CTRL_SOFT_RESET; + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); + val &= ~DW100_DEWARP_CTRL_SOFT_RESET; + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); +} + +static void _dw100_hw_set_master_bus_enable(struct dw100_device *dw_dev, + unsigned int enable) +{ + u32 val; + + dev_dbg(&dw_dev->pdev->dev, "%sable master bus\n", + enable ? "En" : "Dis"); + + val = dw100_read(dw_dev, DW100_BUS_CTRL); + + if (enable) + val |= DW100_BUS_CTRL_AXI_MASTER_ENABLE; + else + val &= ~DW100_BUS_CTRL_AXI_MASTER_ENABLE; + + dw100_write(dw_dev, DW100_BUS_CTRL, val); +} + +static void dw100_hw_master_bus_enable(struct dw100_device *dw_dev) +{ + _dw100_hw_set_master_bus_enable(dw_dev, 1); +} + +static void dw100_hw_master_bus_disable(struct dw100_device *dw_dev) +{ + _dw100_hw_set_master_bus_enable(dw_dev, 0); +} + +static void dw100_hw_dewarp_start(struct dw100_device *dw_dev) +{ + u32 val; + + val = dw100_read(dw_dev, DW100_DEWARP_CTRL); + + dev_dbg(&dw_dev->pdev->dev, "Starting Hardware CTRL:0x%08x\n", val); + dw100_write(dw_dev, DW100_DEWARP_CTRL, val | DW100_DEWARP_CTRL_START); + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); +} + +static void dw100_hw_init_ctrl(struct dw100_device *dw_dev) +{ + u32 val; + /* + * Input format YUV422_SP + * Output format YUV422_SP + * No hardware handshake (SW) + * No automatic double src buffering (Single) + * No automatic double dst buffering (Single) + * No Black Line + * Prefetch image pixel traversal + */ + + val = DW100_DEWARP_CTRL_ENABLE + /* Valid only for auto prefetch mode*/ + | DW100_DEWARP_CTRL_PREFETCH_THRESHOLD(32); + + /* + * Calculation mode required to support any scaling factor, + * but x4 slower than traversal mode. + * + * DW100_DEWARP_CTRL_PREFETCH_MODE_TRAVERSAL + * DW100_DEWARP_CTRL_PREFETCH_MODE_CALCULATION + * DW100_DEWARP_CTRL_PREFETCH_MODE_AUTO + * + * TODO: Find heuristics requiring calculation mode + */ + val |= DW100_DEWARP_CTRL_PREFETCH_MODE_CALCULATION; + + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); +} + +static void dw100_hw_set_pixel_boundary(struct dw100_device *dw_dev) +{ + u32 val; + + val = DW100_BOUNDARY_PIXEL_V(128) + | DW100_BOUNDARY_PIXEL_U(128) + | DW100_BOUNDARY_PIXEL_Y(0); + + dw100_write(dw_dev, DW100_BOUNDARY_PIXEL, val); +} + +static void dw100_hw_set_scale(struct dw100_device *dw_dev, u8 scale) +{ + dev_dbg(&dw_dev->pdev->dev, "Setting scale factor to %u\n", scale); + + dw100_write(dw_dev, DW100_SCALE_FACTOR, scale); +} + +static void dw100_hw_set_roi(struct dw100_device *dw_dev, u32 x, u32 y) +{ + u32 val; + + dev_dbg(&dw_dev->pdev->dev, "Setting ROI region to %u.%u\n", x, y); + + val = DW100_ROI_START_X(x) | DW100_ROI_START_Y(y); + + dw100_write(dw_dev, DW100_ROI_START, val); +} + +static void dw100_hw_set_src_crop(struct dw100_device *dw_dev, + const struct dw100_q_data *src_q_data, + const struct dw100_q_data *dst_q_data) +{ + const struct v4l2_rect *rect = &src_q_data->crop; + u32 src_scale, qscale, left_scale, top_scale; + + /* HW Scale is UQ1.7 encoded */ + src_scale = (rect->width << 7) / src_q_data->pix_fmt.width; + dw100_hw_set_scale(dw_dev, src_scale); + + qscale = (dst_q_data->pix_fmt.width << 7) / src_q_data->pix_fmt.width; + + left_scale = ((rect->left << 7) * qscale) >> 14; + top_scale = ((rect->top << 7) * qscale) >> 14; + + dw100_hw_set_roi(dw_dev, left_scale, top_scale); +} + +static void dw100_hw_set_source(struct dw100_device *dw_dev, + const struct dw100_q_data *q_data, + struct vb2_buffer *buffer) +{ + u32 width, height, stride, fourcc, val; + const struct dw100_fmt *fmt = q_data->fmt; + dma_addr_t addr_y = vb2_dma_contig_plane_dma_addr(buffer, 0); + dma_addr_t addr_uv; + + width = q_data->pix_fmt.width; + height = q_data->pix_fmt.height; + stride = q_data->pix_fmt.plane_fmt[0].bytesperline; + fourcc = q_data->fmt->fourcc; + + if (q_data->pix_fmt.num_planes == 2) + addr_uv = vb2_dma_contig_plane_dma_addr(buffer, 1); + else + addr_uv = addr_y + (stride * height); + + dev_dbg(&dw_dev->pdev->dev, + "Set HW source registers for %ux%u - stride %u, pixfmt: %x, dma:%pad\n", + width, height, stride, fourcc, &addr_y); + + /* Pixel Format */ + val = dw100_read(dw_dev, DW100_DEWARP_CTRL); + + val &= ~DW100_DEWARP_CTRL_INPUT_FORMAT_MASK; + val |= DW100_DEWARP_CTRL_INPUT_FORMAT(fmt->reg_format); + + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); + + /* Swap */ + val = dw100_read(dw_dev, DW100_SWAP_CONTROL); + + val &= ~DW100_SWAP_CONTROL_SRC_MASK; + /* + * Data swapping is performed only on Y plane for source image. + */ + if (fmt->reg_swap_uv && + fmt->reg_format == DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED) + val |= DW100_SWAP_CONTROL_SRC(DW100_SWAP_CONTROL_Y + (DW100_SWAP_CONTROL_BYTE)); + + dw100_write(dw_dev, DW100_SWAP_CONTROL, val); + + /* Image resolution */ + dw100_write(dw_dev, DW100_SRC_IMG_SIZE, + DW100_IMG_SIZE_WIDTH(width) | DW100_IMG_SIZE_HEIGHT(height)); + + dw100_write(dw_dev, DW100_SRC_IMG_STRIDE, stride); + + /* Buffers */ + dw100_write(dw_dev, DW100_SRC_IMG_Y_BASE, DW100_IMG_Y_BASE(addr_y)); + dw100_write(dw_dev, DW100_SRC_IMG_UV_BASE, DW100_IMG_UV_BASE(addr_uv)); +} + +static void dw100_hw_set_destination(struct dw100_device *dw_dev, + const struct dw100_q_data *q_data, + const struct dw100_fmt *ifmt, + struct vb2_buffer *buffer) +{ + u32 width, height, stride, fourcc, val, size_y, size_uv; + const struct dw100_fmt *fmt = q_data->fmt; + dma_addr_t addr_y, addr_uv; + + width = q_data->pix_fmt.width; + height = q_data->pix_fmt.height; + stride = q_data->pix_fmt.plane_fmt[0].bytesperline; + fourcc = fmt->fourcc; + + addr_y = vb2_dma_contig_plane_dma_addr(buffer, 0); + size_y = q_data->pix_fmt.plane_fmt[0].sizeimage; + + if (q_data->pix_fmt.num_planes == 2) { + addr_uv = vb2_dma_contig_plane_dma_addr(buffer, 1); + size_uv = q_data->pix_fmt.plane_fmt[1].sizeimage; + } else { + addr_uv = addr_y + ALIGN(stride * height, 16); + size_uv = size_y; + if (fmt->reg_format == DW100_DEWARP_CTRL_FORMAT_YUV420_SP) + size_uv /= 2; + } + + dev_dbg(&dw_dev->pdev->dev, + "Set HW source registers for %ux%u - stride %u, pixfmt: %x, dma:%pad\n", + width, height, stride, fourcc, &addr_y); + + /* Pixel Format */ + val = dw100_read(dw_dev, DW100_DEWARP_CTRL); + + val &= ~DW100_DEWARP_CTRL_OUTPUT_FORMAT_MASK; + val |= DW100_DEWARP_CTRL_OUTPUT_FORMAT(fmt->reg_format); + + dw100_write(dw_dev, DW100_DEWARP_CTRL, val); + + /* Swap */ + val = dw100_read(dw_dev, DW100_SWAP_CONTROL); + + val &= ~DW100_SWAP_CONTROL_DST_MASK; + + /* + * Avoid to swap twice + */ + if (fmt->reg_swap_uv ^ + (ifmt->reg_swap_uv && ifmt->reg_format != + DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED)) { + if (fmt->reg_format == DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED) + val |= DW100_SWAP_CONTROL_DST(DW100_SWAP_CONTROL_Y + (DW100_SWAP_CONTROL_BYTE)); + else + val |= DW100_SWAP_CONTROL_DST(DW100_SWAP_CONTROL_UV + (DW100_SWAP_CONTROL_BYTE)); + } + + dw100_write(dw_dev, DW100_SWAP_CONTROL, val); + + /* Image resolution */ + dw100_write(dw_dev, DW100_DST_IMG_SIZE, + DW100_IMG_SIZE_WIDTH(width) | DW100_IMG_SIZE_HEIGHT(height)); + dw100_write(dw_dev, DW100_DST_IMG_STRIDE, stride); + dw100_write(dw_dev, DW100_DST_IMG_Y_BASE, DW100_IMG_Y_BASE(addr_y)); + dw100_write(dw_dev, DW100_DST_IMG_UV_BASE, DW100_IMG_UV_BASE(addr_uv)); + dw100_write(dw_dev, DW100_DST_IMG_Y_SIZE1, DW100_DST_IMG_Y_SIZE(size_y)); + dw100_write(dw_dev, DW100_DST_IMG_UV_SIZE1, + DW100_DST_IMG_UV_SIZE(size_uv)); +} + +static void dw100_hw_set_mapping(struct dw100_device *dw_dev, dma_addr_t addr, + u32 width, u32 height) +{ + dev_dbg(&dw_dev->pdev->dev, + "Set HW mapping registers for %ux%u addr:%pad", + width, height, &addr); + + dw100_write(dw_dev, DW100_MAP_LUT_ADDR, DW100_MAP_LUT_ADDR_ADDR(addr)); + dw100_write(dw_dev, DW100_MAP_LUT_SIZE, DW100_MAP_LUT_SIZE_WIDTH(width) + | DW100_MAP_LUT_SIZE_HEIGHT(height)); +} + +static void dw100_hw_clear_irq(struct dw100_device *dw_dev, unsigned int irq) +{ + dw100_write(dw_dev, DW100_INTERRUPT_STATUS, + DW100_INTERRUPT_STATUS_INT_CLEAR(irq)); +} + +static void dw100_hw_enable_irq(struct dw100_device *dw_dev) +{ + dw100_write(dw_dev, DW100_INTERRUPT_STATUS, + DW100_INTERRUPT_STATUS_INT_ENABLE_MASK); +} + +static void dw100_hw_disable_irq(struct dw100_device *dw_dev) +{ + dw100_write(dw_dev, DW100_INTERRUPT_STATUS, 0); +} + +static u32 dw_hw_get_pending_irqs(struct dw100_device *dw_dev) +{ + u32 val; + + val = dw100_read(dw_dev, DW100_INTERRUPT_STATUS); + + return DW100_INTERRUPT_STATUS_INT_STATUS(val); +} + +static irqreturn_t dw100_irq_handler(int irq, void *dev_id) +{ + struct dw100_device *dw_dev = dev_id; + u32 pending_irqs, err_irqs, frame_done_irq; + bool with_error = true; + + pending_irqs = dw_hw_get_pending_irqs(dw_dev); + frame_done_irq = pending_irqs & DW100_INTERRUPT_STATUS_INT_FRAME_DONE; + err_irqs = DW100_INTERRUPT_STATUS_INT_ERR_STATUS(pending_irqs); + + if (frame_done_irq) { + dev_dbg(&dw_dev->pdev->dev, "Frame done interrupt\n"); + with_error = false; + err_irqs &= ~DW100_INTERRUPT_STATUS_INT_ERR_STATUS + (DW100_INTERRUPT_STATUS_INT_ERR_FRAME_DONE); + } + + if (err_irqs) + dev_err(&dw_dev->pdev->dev, "Interrupt error: %#x\n", err_irqs); + + dw100_hw_disable_irq(dw_dev); + dw100_hw_master_bus_disable(dw_dev); + dw100_hw_clear_irq(dw_dev, pending_irqs | + DW100_INTERRUPT_STATUS_INT_ERR_TIME_OUT); + + dw100_job_finish(dw_dev, with_error); + + return IRQ_HANDLED; +} + +static void dw100_start(struct dw100_ctx *ctx, struct vb2_v4l2_buffer *in_vb, + struct vb2_v4l2_buffer *out_vb) +{ + struct dw100_device *dw_dev = ctx->dw_dev; + + out_vb->sequence = + dw100_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)->sequence++; + in_vb->sequence = + dw100_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)->sequence++; + + dev_dbg(&ctx->dw_dev->pdev->dev, + "Starting queues %p->%p, sequence %u->%u\n", + v4l2_m2m_get_vq(ctx->fh.m2m_ctx, + V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE), + v4l2_m2m_get_vq(ctx->fh.m2m_ctx, + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE), + in_vb->sequence, out_vb->sequence); + + v4l2_m2m_buf_copy_metadata(in_vb, out_vb, true); + + /* Now, let's deal with hardware ... */ + dw100_hw_master_bus_disable(dw_dev); + dw100_hw_init_ctrl(dw_dev); + dw100_hw_set_pixel_boundary(dw_dev); + dw100_hw_set_src_crop(dw_dev, &ctx->q_data[DW100_QUEUE_SRC], + &ctx->q_data[DW100_QUEUE_DST]); + dw100_hw_set_source(dw_dev, &ctx->q_data[DW100_QUEUE_SRC], + &in_vb->vb2_buf); + dw100_hw_set_destination(dw_dev, &ctx->q_data[DW100_QUEUE_DST], + ctx->q_data[DW100_QUEUE_SRC].fmt, + &out_vb->vb2_buf); + dw100_hw_set_mapping(dw_dev, ctx->map_dma, + ctx->map_width, ctx->map_height); + dw100_hw_enable_irq(dw_dev); + dw100_hw_dewarp_start(dw_dev); + + /* Enable Bus */ + dw100_hw_master_bus_enable(dw_dev); +} + +static void dw100_device_run(void *priv) +{ + struct dw100_ctx *ctx = priv; + struct vb2_v4l2_buffer *src_buf, *dst_buf; + + src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); + dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); + + dw100_start(ctx, src_buf, dst_buf); +} + +static const struct v4l2_m2m_ops dw100_m2m_ops = { + .device_run = dw100_device_run, +}; + +static struct video_device *dw100_init_video_device(struct dw100_device *dw_dev) +{ + struct video_device *vfd = &dw_dev->vfd; + + vfd->vfl_dir = VFL_DIR_M2M; + vfd->fops = &dw100_fops; + vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; + vfd->ioctl_ops = &dw100_ioctl_ops; + vfd->minor = -1; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dw_dev->v4l2_dev; + vfd->lock = &dw_dev->vfd_mutex; + + strscpy(vfd->name, DRV_NAME, sizeof(vfd->name)); + mutex_init(vfd->lock); + video_set_drvdata(vfd, dw_dev); + + return vfd; +} + +static int dw100_dump_regs_show(struct seq_file *m, void *private) +{ + struct dw100_device *dw_dev = m->private; + int ret; + + ret = pm_runtime_resume_and_get(&dw_dev->pdev->dev); + if (ret < 0) + return ret; + + ret = dw100_dump_regs(m); + + pm_runtime_put_sync(&dw_dev->pdev->dev); + + return ret; +} +DEFINE_SHOW_ATTRIBUTE(dw100_dump_regs); + +static void dw100_debugfs_init(struct dw100_device *dw_dev) +{ + dw_dev->debugfs_root = + debugfs_create_dir(dev_name(&dw_dev->pdev->dev), NULL); + + debugfs_create_file("dump_regs", 0600, dw_dev->debugfs_root, dw_dev, + &dw100_dump_regs_fops); +} + +static void dw100_debugfs_exit(struct dw100_device *dw_dev) +{ + debugfs_remove_recursive(dw_dev->debugfs_root); +} + +static int dw100_probe(struct platform_device *pdev) +{ + struct dw100_device *dw_dev; + struct video_device *vfd; + struct resource *res; + int ret, irq; + + dw_dev = devm_kzalloc(&pdev->dev, sizeof(*dw_dev), GFP_KERNEL); + if (!dw_dev) + return -ENOMEM; + dw_dev->pdev = pdev; + + ret = devm_clk_bulk_get_all(&pdev->dev, &dw_dev->clks); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to get clocks: %d\n", ret); + return ret; + } + dw_dev->num_clks = ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + dw_dev->mmio = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(dw_dev->mmio)) + return PTR_ERR(dw_dev->mmio); + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + platform_set_drvdata(pdev, dw_dev); + + pm_runtime_enable(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to resume the device: %d\n", ret); + goto err_pm; + } + + pm_runtime_put_sync(&pdev->dev); + + ret = devm_request_irq(&pdev->dev, irq, dw100_irq_handler, IRQF_ONESHOT, + dev_name(&pdev->dev), dw_dev); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to request irq: %d\n", ret); + return ret; + } + + ret = v4l2_device_register(&pdev->dev, &dw_dev->v4l2_dev); + if (ret) + goto err_pm; + + vfd = dw100_init_video_device(dw_dev); + + dw_dev->m2m_dev = v4l2_m2m_init(&dw100_m2m_ops); + if (IS_ERR(dw_dev->m2m_dev)) { + dev_err(&pdev->dev, "Failed to init mem2mem device\n"); + ret = PTR_ERR(dw_dev->m2m_dev); + goto err_v4l2; + } + + dw_dev->mdev.dev = &pdev->dev; + strscpy(dw_dev->mdev.model, "dw100", sizeof(dw_dev->mdev.model)); + media_device_init(&dw_dev->mdev); + dw_dev->v4l2_dev.mdev = &dw_dev->mdev; + + ret = video_register_device(vfd, VFL_TYPE_VIDEO, -1); + if (ret) { + dev_err(&pdev->dev, "Failed to register video device\n"); + goto err_m2m; + } + + ret = v4l2_m2m_register_media_controller(dw_dev->m2m_dev, vfd, + MEDIA_ENT_F_PROC_VIDEO_SCALER); + if (ret) { + dev_err(&pdev->dev, "Failed to init mem2mem media controller\n"); + goto error_v4l2; + } + + ret = media_device_register(&dw_dev->mdev); + if (ret) { + dev_err(&pdev->dev, "Failed to register mem2mem media device\n"); + goto error_m2m_mc; + } + + dw100_debugfs_init(dw_dev); + + dev_info(&pdev->dev, + "dw100 v4l2 m2m registered as /dev/video%u\n", vfd->num); + + return 0; + +error_m2m_mc: + v4l2_m2m_unregister_media_controller(dw_dev->m2m_dev); +error_v4l2: + video_unregister_device(vfd); +err_m2m: + v4l2_m2m_release(dw_dev->m2m_dev); +err_v4l2: + v4l2_device_unregister(&dw_dev->v4l2_dev); +err_pm: + pm_runtime_disable(&pdev->dev); + + return ret; +} + +static int dw100_remove(struct platform_device *pdev) +{ + struct dw100_device *dw_dev = platform_get_drvdata(pdev); + + dw100_debugfs_exit(dw_dev); + + pm_runtime_disable(&pdev->dev); + + media_device_unregister(&dw_dev->mdev); + v4l2_m2m_unregister_media_controller(dw_dev->m2m_dev); + media_device_cleanup(&dw_dev->mdev); + + video_unregister_device(&dw_dev->vfd); + mutex_destroy(dw_dev->vfd.lock); + v4l2_m2m_release(dw_dev->m2m_dev); + v4l2_device_unregister(&dw_dev->v4l2_dev); + + return 0; +} + +static int __maybe_unused dw100_runtime_suspend(struct device *dev) +{ + struct dw100_device *dw_dev = dev_get_drvdata(dev); + + clk_bulk_disable_unprepare(dw_dev->num_clks, dw_dev->clks); + + return 0; +} + +static int __maybe_unused dw100_runtime_resume(struct device *dev) +{ + int ret; + struct dw100_device *dw_dev = dev_get_drvdata(dev); + + ret = clk_bulk_prepare_enable(dw_dev->num_clks, dw_dev->clks); + + if (ret) + return ret; + + dw100_hw_reset(dw_dev); + + return 0; +} + +static const struct dev_pm_ops dw100_pm = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(dw100_runtime_suspend, + dw100_runtime_resume, NULL) +}; + +static const struct of_device_id dw100_dt_ids[] = { + { .compatible = "nxp,imx8mp-dw100", .data = NULL }, + { }, +}; +MODULE_DEVICE_TABLE(of, dw100_dt_ids); + +static struct platform_driver dw100_driver = { + .probe = dw100_probe, + .remove = dw100_remove, + .driver = { + .name = DRV_NAME, + .pm = &dw100_pm, + .of_match_table = dw100_dt_ids, + }, +}; + +module_platform_driver(dw100_driver); + +MODULE_DESCRIPTION("DW100 Hardware dewarper"); +MODULE_AUTHOR("Xavier Roumegue "); +MODULE_LICENSE("GPL"); diff --git a/drivers/media/platform/nxp/dw100/dw100_regs.h b/drivers/media/platform/nxp/dw100/dw100_regs.h new file mode 100644 index 000000000000..e85dfeff9056 --- /dev/null +++ b/drivers/media/platform/nxp/dw100/dw100_regs.h @@ -0,0 +1,117 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * DW100 Hardware dewarper + * + * Copyright 2022 NXP + * Author: Xavier Roumegue (xavier.roumegue@oss.nxp.com) + */ + +#ifndef _DW100_REGS_H_ +#define _DW100_REGS_H_ + +/* AHB register offset */ +#define DW100_DEWARP_ID 0x00 +#define DW100_DEWARP_CTRL 0x04 +#define DW100_DEWARP_CTRL_ENABLE BIT(0) +#define DW100_DEWARP_CTRL_START BIT(1) +#define DW100_DEWARP_CTRL_SOFT_RESET BIT(2) +#define DW100_DEWARP_CTRL_FORMAT_YUV422_SP 0UL +#define DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED 1UL +#define DW100_DEWARP_CTRL_FORMAT_YUV420_SP 2UL +#define DW100_DEWARP_CTRL_INPUT_FORMAT_MASK GENMASK(5, 4) +#define DW100_DEWARP_CTRL_INPUT_FORMAT(x) ((x) << 4) +#define DW100_DEWARP_CTRL_OUTPUT_FORMAT(x) ((x) << 6) +#define DW100_DEWARP_CTRL_OUTPUT_FORMAT_MASK GENMASK(7, 6) +#define DW100_DEWARP_CTRL_SRC_AUTO_SHADOW BIT(8) +#define DW100_DEWARP_CTRL_HW_HANDSHAKE BIT(9) +#define DW100_DEWARP_CTRL_DST_AUTO_SHADOW BIT(10) +#define DW100_DEWARP_CTRL_SPLIT_LINE BIT(11) +#define DW100_DEWARP_CTRL_PREFETCH_MODE_MASK GENMASK(17, 16) +#define DW100_DEWARP_CTRL_PREFETCH_MODE_TRAVERSAL (0UL << 16) +#define DW100_DEWARP_CTRL_PREFETCH_MODE_CALCULATION (1UL << 16) +#define DW100_DEWARP_CTRL_PREFETCH_MODE_AUTO (2UL << 16) +#define DW100_DEWARP_CTRL_PREFETCH_THRESHOLD_MASK GENMASK(24, 18) +#define DW100_DEWARP_CTRL_PREFETCH_THRESHOLD(x) ((x) << 18) + +#define DW100_MAP_LUT_ADDR 0x08 +#define DW100_MAP_LUT_ADDR_ADDR(addr) (((addr) >> 4) & GENMASK(29, 0)) +#define DW100_MAP_LUT_SIZE 0x0c +#define DW100_MAP_LUT_SIZE_WIDTH(w) (((w) & GENMASK(10, 0)) << 0) +#define DW100_MAP_LUT_SIZE_HEIGHT(h) (((h) & GENMASK(10, 0)) << 16) +#define DW100_SRC_IMG_Y_BASE 0x10 +#define DW100_IMG_Y_BASE(base) (((base) >> 4) & GENMASK(29, 0)) +#define DW100_SRC_IMG_UV_BASE 0x14 +#define DW100_IMG_UV_BASE(base) (((base) >> 4) & GENMASK(29, 0)) +#define DW100_SRC_IMG_SIZE 0x18 +#define DW100_IMG_SIZE_WIDTH(w) (((w) & GENMASK(12, 0)) << 0) +#define DW100_IMG_SIZE_HEIGHT(h) (((h) & GENMASK(12, 0)) << 16) + +#define DW100_SRC_IMG_STRIDE 0x1c +#define DW100_MAP_LUT_ADDR2 0x20 +#define DW100_MAP_LUT_SIZE2 0x24 +#define DW100_SRC_IMG_Y_BASE2 0x28 +#define DW100_SRC_IMG_UV_BASE2 0x2c +#define DW100_SRC_IMG_SIZE2 0x30 +#define DW100_SRC_IMG_STRIDE2 0x34 +#define DW100_DST_IMG_Y_BASE 0x38 +#define DW100_DST_IMG_UV_BASE 0x3c +#define DW100_DST_IMG_SIZE 0x40 +#define DW100_DST_IMG_STRIDE 0x44 +#define DW100_DST_IMG_Y_BASE2 0x48 +#define DW100_DST_IMG_UV_BASE2 0x4c +#define DW100_DST_IMG_SIZE2 0x50 +#define DW100_DST_IMG_STRIDE2 0x54 +#define DW100_SWAP_CONTROL 0x58 +#define DW100_SWAP_CONTROL_BYTE BIT(0) +#define DW100_SWAP_CONTROL_SHORT BIT(1) +#define DW100_SWAP_CONTROL_WORD BIT(2) +#define DW100_SWAP_CONTROL_LONG BIT(3) +#define DW100_SWAP_CONTROL_Y(x) (((x) & GENMASK(3, 0)) << 0) +#define DW100_SWAP_CONTROL_UV(x) (((x) & GENMASK(3, 0)) << 4) +#define DW100_SWAP_CONTROL_SRC(x) (((x) & GENMASK(7, 0)) << 0) +#define DW100_SWAP_CONTROL_DST(x) (((x) & GENMASK(7, 0)) << 8) +#define DW100_SWAP_CONTROL_SRC2(x) (((x) & GENMASK(7, 0)) << 16) +#define DW100_SWAP_CONTROL_DST2(x) (((x) & GENMASK(7, 0)) << 24) +#define DW100_SWAP_CONTROL_SRC_MASK GENMASK(7, 0) +#define DW100_SWAP_CONTROL_DST_MASK GENMASK(15, 8) +#define DW100_SWAP_CONTROL_SRC2_MASK GENMASK(23, 16) +#define DW100_SWAP_CONTROL_DST2_MASK GENMASK(31, 24) +#define DW100_VERTICAL_SPLIT_LINE 0x5c +#define DW100_HORIZON_SPLIT_LINE 0x60 +#define DW100_SCALE_FACTOR 0x64 +#define DW100_ROI_START 0x68 +#define DW100_ROI_START_X(x) (((x) & GENMASK(12, 0)) << 0) +#define DW100_ROI_START_Y(y) (((y) & GENMASK(12, 0)) << 16) +#define DW100_BOUNDARY_PIXEL 0x6c +#define DW100_BOUNDARY_PIXEL_V(v) (((v) & GENMASK(7, 0)) << 0) +#define DW100_BOUNDARY_PIXEL_U(u) (((u) & GENMASK(7, 0)) << 8) +#define DW100_BOUNDARY_PIXEL_Y(y) (((y) & GENMASK(7, 0)) << 16) + +#define DW100_INTERRUPT_STATUS 0x70 +#define DW100_INTERRUPT_STATUS_INT_FRAME_DONE BIT(0) +#define DW100_INTERRUPT_STATUS_INT_ERR_TIME_OUT BIT(1) +#define DW100_INTERRUPT_STATUS_INT_ERR_AXI_RESP BIT(2) +#define DW100_INTERRUPT_STATUS_INT_ERR_X BIT(3) +#define DW100_INTERRUPT_STATUS_INT_ERR_MB_FETCH BIT(4) +#define DW100_INTERRUPT_STATUS_INT_ERR_FRAME2 BIT(5) +#define DW100_INTERRUPT_STATUS_INT_ERR_FRAME3 BIT(6) +#define DW100_INTERRUPT_STATUS_INT_ERR_FRAME_DONE BIT(7) +#define DW100_INTERRUPT_STATUS_INT_ERR_STATUS(x) (((x) >> 1) & 0x7f) +#define DW100_INTERRUPT_STATUS_INT_STATUS(x) ((x) & 0xff) + +#define DW100_INTERRUPT_STATUS_INT_ENABLE_MASK GENMASK(15, 8) +#define DW100_INTERRUPT_STATUS_INT_ENABLE(x) (((x) & GENMASK(7, 0)) << 8) +#define DW100_INTERRUPT_STATUS_FRAME_BUSY BIT(16) +#define DW100_INTERRUPT_STATUS_INT_CLEAR(x) (((x) & GENMASK(7, 0)) << 24) +#define DW100_BUS_CTRL 0x74 +#define DW100_BUS_CTRL_AXI_MASTER_ENABLE BIT(31) +#define DW100_BUS_CTRL1 0x78 +#define DW100_BUS_TIME_OUT_CYCLE 0x7c +#define DW100_DST_IMG_Y_SIZE1 0x80 +#define DW100_DST_IMG_Y_SIZE(sz) (((sz) >> 4) & GENMASK(29, 0)) +#define DW100_DST_IMG_UV_SIZE(sz) (((sz) >> 4) & GENMASK(29, 0)) +#define DW100_DST_IMG_UV_SIZE1 0x84 +#define DW100_DST_IMG_Y_SIZE2 0x88 +#define DW100_DST_IMG_UV_SIZE2 0x8c + +#endif /* _DW100_REGS_H_ */ From patchwork Wed Jul 13 21:11:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12917124 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 03E2ECCA479 for ; Wed, 13 Jul 2022 21:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237368AbiGMVMG (ORCPT ); Wed, 13 Jul 2022 17:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237350AbiGMVMB (ORCPT ); Wed, 13 Jul 2022 17:12:01 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 360123341D; Wed, 13 Jul 2022 14:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DKkJlgekWRUeqO7hDkbYRQSppivGyxZe3MhE2cy9zyqWfTWQokDTo+ba75vi6vV9iqvT5jNPBZk4EV+COjEKgc5Wpm8WWLvK3gAtahx2H7Prbk5keYlQmDwOmqgb/QHFDA2BY5MEH2ceNtO53g23KRB6+YYLO2ri7eEH1mMPqQfIqs/0A5+N3iqk8mCGSLFgxqUbIIWBXHeY88u8a8DBM71Q1DeFebiMnxHrWvP9i0SBOPgKNZfe09XI0joISz6ut02Iu3Wq1+Nfk4z/CHRZCQ0MAAajcCIfHIeMI3nqJFdW/HeOJOTDrIk6nedTGLwx3GOEdEY5w4pzjuBuqJSAkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ovrcl+8ua66la0c/B04Ms+KmUl+7NtWMDBTceDurdr4=; b=n2UKASkeMbPN0LukGi8WmYuKwQ6paRLn7UM2zq75EPo2Cl7z/5AbX5/mAH8EVpzNxGEoetTicn6T4zM+YIyIwAKqijnHZKqFEL9YBxglDQkIbOYZV5RnHxwpDEM/DudakXxlbzP7wkbzpq/fhPuM2hGYWXLeBRCxEmVZaBn0OCN7EVUEgadgk64VNXZzTpjeO9x4DhyzGCHc2sqFCzsC7ehcfC03qvnzUIqcxVvM+77lIpbrlGHnZT3pIqf/ESYi5E56qRclMV+5/HKr28okVp5JJhMioNGC2qtsiWJ16XI6kwh53lE4RMwULzKo5osIR8rk148a8sciDc76/mqPnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ovrcl+8ua66la0c/B04Ms+KmUl+7NtWMDBTceDurdr4=; b=Xm4iCTGbF8pdn8ABzOVrnOIbEkfsoMiiiwYKoOW1mwHOzRji3PtzC5+ClTJO3lrINK+DWEYjugSXdGGk/wF7BNcPi48P49DVEpYBbcF/1nHCdRIZsUSU/zJpJDWISAHwOG2vpAjdiVRL6Xw8EdpMLRwUpMEL9w8HFaEX2NvhTi8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM9PR04MB8874.eurprd04.prod.outlook.com (2603:10a6:20b:409::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Wed, 13 Jul 2022 21:11:57 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::d51c:319c:bf4:199f%5]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 21:11:57 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com, ezequiel@vanguardiasur.com.ar Cc: Xavier Roumegue , linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v7 6/6] media: MAINTAINERS: add entry for i.MX8MP DW100 v4l2 mem2mem driver Date: Wed, 13 Jul 2022 23:11:24 +0200 Message-Id: <20220713211124.2677275-7-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> References: <20220713211124.2677275-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR0P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::35) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 397d62ed-08ab-43ed-5214-08da651451b7 X-MS-TrafficTypeDiagnostic: AM9PR04MB8874:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yAfRad7/PLzcnOdz1hReSjFAAQB7dERkBW8CHsJJmhiDxx8ru04ZUDro3pEgkP7aMvSsjgBKbzb8ffaP3dK6tLIrekBpIMxhkGnVI0jWefxgPVsZY2YHQVl3/A5ZJBJ0f+fmtvf1KfTReAXBAwwXt3yCCeotZTKbp3SK1gypSPxFxEuQA0+pqPsFCa2exCTirbjYKg9NXAloqBesc5HfmMTpyO7o4zD6EEfvk/56UF4FZgwXuQaQrXpS5CS1D5XSUCHSccMCKUu8P+z4AFOfTb0ClWxnNbkj/wQ8PVNgjBYezrYGczaHKky7yClL1s0EzOpEHnLWcsyDUuvepbe01ewc08Yv3O8JzBaKUxEitRLbD9qcOofE1etgFJWzEK8rOWuSamYs33pSrUPPsxRgmSivfwIDk5DGJESTjD/Jv9uhEGcEV1oMcumgF6Fd1WZ/jGjq4CV5d2jpAyms3CLXeZ1mGMIgqD5OlQZ7qrCRRht0NYBt/dtPnCkgPhfXp9G9veiLdh2WSscXrwd91+ekRB9Wnwh4//uWCv/uj6B7VIum3OP+u2PGLwVpu80R1DAYvaumRj/Zj/IcmlRbBAX0DgJrErnKDcYerND1Nmq0e9ZgjE9o2BVOsOYl5IzMktikcqmwfuYRPmHm9ZLZqJ3P8l8LOizaeIaybvga6dDdDFEiGEPpLXuYQI2Ni+M0rc1HaCFw9PPWWETy9Sp3VehUYyWyqSkYVk42lkTSQc0zR4zapOy16Xa80+t5MwhHTOxqTa8RGrkQcOnNMI2Lscmv5A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(41300700001)(8936002)(44832011)(7416002)(186003)(4744005)(5660300002)(2906002)(6486002)(6666004)(38100700002)(4326008)(478600001)(316002)(52116002)(66556008)(66476007)(8676002)(6506007)(66946007)(2616005)(6512007)(86362001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dlHqIAU0Hxatl8SpVlVJMpewBDZ4eiVBMQj/YIV0OGRfu5mu/HlvhI+VTpe4qr0kA9M2G0XMfTnWYF7GpePzKvUvNvrGlMSszvdwE77ifsirV7Mjhv/gyp2yq0hmIMURnLaqPfuyTXL5ud16wHahmXYE2W7Dj4hf2b6W0R5oe2Ycqa71yVNLW8tTZEFL4f9TOCgR4xFefcAhdHXjHLhwa2M+N9zAjsa+Idt/sp6t8iVSrhExWn83beMHMTuETbH8YBk9D+0bxTppcto0UWfnEX5QpgZ7Uqh5Kg8iiuWYXxdpUdaoNMvCpy1RThJ3cY+nD2zow4i1CD6DGDexm/BAmxhf1J0310hL92xQ8LpTBoWGX+eB1o7T4XOYtWidxsEfCJ2skYmUCYuJfJgiz+f2XJ6ZrAJP7Y5GdT1r47qlgEoe9C1C8N979E8gwylgRyL/FhMVQaXerbKyqmBq7yIsWn+Y8mhfp9ue7fjB+qZlBxaxYB1DQ1R4PPBh/CTwop/5JJ1iWAD5Pv0lvCwwigJnmecYBkrRHar+gy8dM4vmnx+lCHtTRq67npidOLtSimhP22kIM3149/Ez13eQaRH5gTfQ+xKvwcYLLpQkqkT0Jr7ILw3+jnyGLRR2s9jf0XCz/QdsGtFEHCe44+RBHCtrMo73F6Qzo/7eMaY+4AHBmMwryBwZziK7SqlTSrMBHo5o2+804PXYPghnRGwU8ra/uPQsuWU1xcZHR8/o6jd/dcKxm4G61HxcH+LAzuwarfinB8ziSgiwAZp8B81BGZBX8hRGL8y4i3A+xKK3r78jRns1JDnUXnOvlXxZcNjtRioUtXtuVxjJUu4HFCbHZ//pdxba37oRLxdeupNDXmuVAzIr1n8mnN9P2LFu9IZiD0F7momxj15UQlgDrwsYAwr5sKqLfsj8Zg957yjr0MlektBp2RuN1dd1VypuvH3ab54l4H/2Ix4JdR4KYqH7TCLJSeeOWEz528KsVUUPZsWiyhSSkKbWEWsKulUhlYMSZ14GSDcE191AcmJNjHZ+65OFWs0rsr2LrNpiWY2V+/82R32J9KnGzYptqQtqdhiWnSRFD+Vqar0XOAcjOR0bH6fk1OArDizFKaqO88geJzMQCsRUygNVrgEygmNcjky+HK7cpDXLE/aZh6fEnGUbBOoSb/vftO45lr/OK7lBynDOHwriR+ebPu/qg1WyjfpWsvHLUzpcbGYH2OKDMmgZIO2eKx8dLssY25mD/v1sq/WeHO8NQhUxm8o2KvWj0tHo3qa3z3hcL6J9ldcwHGGZJIJzrioB+bTVcZgxBbon/0Ux1zPG7kmcjEvd7AYumD/oJXOR91bpQAJK1ucYwe9ZXoV/9Myd7csFXQozMsmKDW9SBWDusTiOaHazfSJsQL4oy+pgtYm0Z1YMwXcsKsUSO1o9NBtmBYFXS9ky+Lezy3bnsjf888JqLlmSni6J3xssEvcs88p+g1cSz4jl9cvF8Ue2v9bwxS7R3suoeySFM4FhBJD+rLsnvtUVuZNYiM6ov35pLRudVyOtoHJQv9JIkCLnmmR8QchSiqzrSWMDnMlERU8EGHGGjkMzL1BavRi6dxpXioss5kw5DUv+Pc6i8vY26zLFo2jXCypbgtaMW6zXyPoAPhmTQGfN67xBmZjCNDzCn/LjnwwlMzKOFpDfMMzuOQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 397d62ed-08ab-43ed-5214-08da651451b7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 21:11:57.2472 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9YUzL7avMM1gFIw6NlswtNSR+mMxeXg2ZvQyIKsr+S2u3nrvhgF9uQQ5FnwRQLiiB1FTOWYWAwBTP1TosTmxXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8874 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add myself as maintainer of the dw100 driver which offers hardware accelerated dewarping operations through a v4l2 mem2mem interface. Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1fc9ead83d2a..a2e1174bc0be 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14355,6 +14355,15 @@ S: Supported F: Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml F: drivers/nfc/nxp-nci +NXP i.MX 8MP DW100 V4L2 DRIVER +M: Xavier Roumegue +L: linux-media@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/media/nxp,dw100.yaml +F: Documentation/userspace-api/media/drivers/dw100.rst +F: drivers/media/platform/nxp/dw100/ +F: include/uapi/linux/dw100.h + NXP i.MX 8QXP/8QM JPEG V4L2 DRIVER M: Mirela Rabulea R: NXP Linux Team