From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.72.2 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796142117; b=5SBoBBji9Q1XmJ5Wj/OIGMaTEA9BVF4tmb0523MAw1UWX9aCzNBUQBuPuN7PP0R4FP3P tK8FDgILncYweUPgppjzy1hSQE3jxDCdpZE7NS/mdWEA+EHyRA9G8TR5ZsTBK2ircEcch QQtud75N+wGZ9uYi882UIml2oi5aycWJLvnUdPAgUZ8gKtsmaNsebEKioeze+OTX8ly5H EtuZM33kRYhfE/MVZvpNIqO+T1pJdusKWagZVOc1sd2UQMk25/M+so9OHFCP9NR5vDj6A Q1v9fwm0de15/CDs1k/dLBbgiRc7ddnXSMJSoN/S9te7ItEIYEosLyoBPobeUjmOGuw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796142117; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:Content-Type:Content-Disposition: In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=7hwvOZVefE+NhIt2qdITQ7FN7jH0X1SVwGPvfBUlCgc=; b=xn8981JTZAGn+Hez8ZHgxa2JW8+0JHeKiE1DWOhJOfNmZd4QXkJEV4S1dqqMibezPVZ4 3OBG1Apk6MDTZZ4eRfwrUIlx4fKtAm6Pyml3GJm9IH2icBllt4M1IRhKuRojVjW2QnH5D bunDbCt4aCBfB1oJ1M/3vmcM4Fy59SCoJ7NIai3gvj8++/2yu+WfmfGBZbvjVafL3NxrA CbB4s4mIB5/LViPUCyQ7A9f0FVDNr7b/wWJ5qK8tCm16YrcSIAaP+yuxvZ/FkrchSGIDV j6/DFP/6up6YMhQGZuGCHKMbeya3yBOrzaXKegdrAINEXlzzE0IbXdOzDD2FkpXdeaQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-NXP1-onmicrosoft-com header.b=MuCPmRQZ; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.72.2 Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11013002.outbound.protection.outlook.com [52.101.72.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53EFA606ABC6; Tue, 1 Dec 2026 16:21:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 53EFA606ABC6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-NXP1-onmicrosoft-com header.b=MuCPmRQZ ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CjO4Itf8dCjcP7QvspIXydqQ4MeP4ITxdDlKvDGaR6ALwb2cnG9fDAPLHeXNYhGA1Xk55SwIOYwj7R0CDWulszsD2sEeuLqFYRehXKmGpS0jHuoNiptG43pg04qiS1xdeZKur+MaGwwzr9dJaLI5nQUsOPgL1NgSDOOGUbcgqs2AYfLMs5a+dtjsvAbg4ToTxywyr1tGjipv5FawDvLSU1TksuMDjmu3ewLuv9bFT8ylXnbwZctf5YEiAH+zPMAV+ZigG/CVVIziNXoOWwrkiy4I9sp96fvLhKxrPB1pd5Xg1/pdhK5VObeOzN8DhjBBLPyF+xNFUTxxOL0nOH9TEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7hwvOZVefE+NhIt2qdITQ7FN7jH0X1SVwGPvfBUlCgc=; b=XrKFnao/CUmXoEKb2fDh2KuwT/2gg/9yZTDGBRO6pTI1Tyl3waOpsIBfDW1cJ3CrVrdjyp1sVjXqoO7l9Ik22Dk+nSUH73T7bsqINPCHu/1Hg+tC/cVhVUi63/GiJYDL+H4CX/FO7J4dIhBLqGeB9hgacWJOkKNhJs13r9VH4NYJ4zeAMygfS0yoS5awY547BHR1NRAYZTUMO1Cm90bohgXPdViGnbZyQGO86PKTxOUGXgMUzehFvJV65BpGQXe6aC1mCXF3PlIPJ/wByJ86rDPIZF6RhkRaKAYL4movkGOgX63ID6XwuTexG4bkXTPTOuXNZ16QPrSErTAzhwiuzw== 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=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7hwvOZVefE+NhIt2qdITQ7FN7jH0X1SVwGPvfBUlCgc=; b=MuCPmRQZXI3ptl7P/CaxxIHQWc9mW0p1z8XUmrZZBmPnLhqkedRV0wvb9fXhmG34ihhphgLqSb8P4IfLMCU9SnAN6PUOjPr5tjHu4nXqScFmjfbwVeT0BeEj8iovR9MU/dCzoN/9c4XeqI+ZHEX4/8kyLWN4Qp6hd/Ybs0NGG4LACeNYc3kpeWbNdNAiCnSvdD3bbZHK+kKa3sxDyTVPTouc/SMWckCi6gy1fp4l6XwnEL0MWDqlUYor7IJ3xwHYVnXuA3VasYIT21mZzVJNe8/WUonxjJzdi+YnLTbhizrJhp2a4Sa4lWrPsAWsV4TLPGBzcxdITfdVWdLnNkfnaA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from MI3PR04MB12438.eurprd04.prod.outlook.com (2603:10a6:290:76::14) by PA4PR04MB7885.eurprd04.prod.outlook.com (2603:10a6:102:ce::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 16:21:50 +0000 Received: from MI3PR04MB12438.eurprd04.prod.outlook.com ([fe80::c715:c32:8bb1:b70b]) by MI3PR04MB12438.eurprd04.prod.outlook.com ([fe80::c715:c32:8bb1:b70b%4]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 16:21:49 +0000 Date: Tue, 1 Dec 2026 10:21:40 -0600 From: Frank Li To: Jiaqi Shi Cc: linux-media@vger.kernel.org, imx@lists.linux.dev, linux-staging@lists.linux.dev, slongerbeam@gmail.com, p.zabel@pengutronix.de, mchehab@kernel.org, gregkh@linuxfoundation.org, Frank.Li@nxp.com, kernel@pengutronix.de, festevam@gmail.com Subject: Re: [PATCH v8 1/2] media: imx: remove legacy video node control and format handling Message-ID: References: <20261201152647.847238-1-shijiaqi_develop@163.com> <20261201152647.847238-2-shijiaqi_develop@163.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201152647.847238-2-shijiaqi_develop@163.com> X-ClientProxiedBy: PH8P220CA0048.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:2d9::25) To MI3PR04MB12438.eurprd04.prod.outlook.com (2603:10a6:290:76::14) X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PR04MB12438:EE_|PA4PR04MB7885:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cb832d8-a0f5-485d-6177-08df4fc733d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|19092799006|7416014|376014|23010399003|366016|4143699003|6133799003|18002099003|22082099003|3023799007|10067099003|11063799006|5023799004|56012099006|261026140227099003|261026121527099003|261102123227099003|261021121427099003|261028144727099003|261022115727099003|261009223027099003|261102130727099003|261022105027099003|261022075727099003|261021123027099003; X-Microsoft-Antispam-Message-Info: uMdmelfVj/Hi1fARmSLBHiaA0Ld0w4j3FkL5LpHinIEM5ezpo4fMBF/PHMt0ELE2h0BLcCx5+w2nu74ns8D2KCxxe4d2/Ou78QrQzNKaSr1vxFu9ocjt1mXmE6T5BenHcO6DW+7kgW0d/TrX2CrWwprL+2iNISR2JrZRJ/r0rjP7VXS6QnH32/tg43+j4r8U7/HsjaHKU6YOYKIpH7h7Eu/1VVUnkNXaXqq7sEcrCFcsmo31AHE5jtbWcPZ1RIl3uND6TyoIva5c6cSMqVh7lFV/7hwNYy/0evfpaFX7CaQsn04sFrTozB1y6vKWDqmeO/WJmKVYdF2j9TkvUc/fylty8fR+2ezsnGwulRpQCDRR6G7IR4LixvNcGTjIJI6otN5rfenmgtzYazTg2T5Jo8whggiNzJWb0UcT+ko+6hUcTsQwlQuSl9MaJJGOgCg3DGsq6sNrPmkbHNodjKu/RWpNObFYIk8O4P7JzelZ9qVc5mhXADIsNp0Rrv6HCxhE2g49Rxsb76e0zWo8SsujSIN382gI3QXOAMqBQGt0cCCkjFITgc1aTWekPTMDs2zzVMAbix0TqGZMVig6xld513HmIt/Zslfol1u5saCaIJC1S94HEzg8YDdsNorPSQiXUwfXlrhx4kGA3bFuUuB7h8vwDm+6dyihk6OoBSAtNuE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MI3PR04MB12438.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(19092799006)(7416014)(376014)(23010399003)(366016)(4143699003)(6133799003)(18002099003)(22082099003)(3023799007)(10067099003)(11063799006)(5023799004)(56012099006)(261026140227099003)(261026121527099003)(261102123227099003)(261021121427099003)(261028144727099003)(261022115727099003)(261009223027099003)(261102130727099003)(261022105027099003)(261022075727099003)(261021123027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eawZ9qvRe2EyZWVJ+zhrpq6d09P+RhQ1w5kOddAFkbnQHLbhdwuKPaDV7Bmb?= =?us-ascii?Q?cprbHGy5TVlW8fsBWE+qK9diLwUXgWv2usLkr648uZvYYQdddmbXQmJTwWrV?= =?us-ascii?Q?8xglW/H6ST1MxucNhgSx+4c2DBSq1ShV62X4eUdwjglTNzTkTVxEAIQ6zXCk?= =?us-ascii?Q?it13xJByuls5PI7G7skFZVnXEI38wK3joi5kwnDzBYjVxibt3PW+QPk9RYty?= =?us-ascii?Q?pcuoKdwybg4RZXuzpYPrX05FPAnrqBwipaxI3/i3zWinFWjq2ykZf11lsD/O?= =?us-ascii?Q?ZW26Q5OIomPbxJ0uN1C8QmdFoWolvczk1bPDowQrbtZkgqFH0xJemKsBHMeQ?= =?us-ascii?Q?ogXYifhCzPoebunMJsoCSqo4Xi9YRKhOmrnoylOj6wbRdeyvXgqEx/Y/rUJE?= =?us-ascii?Q?qyAxrCTOsNjOvSElWt21Y3wWdsCKmScW1MAuPwbddP30sVzUsEJB6qnQNGam?= =?us-ascii?Q?cmaIfq47ANzBB7zfOI/kAmMSYToUbeKAUBhhtQcIEuNI8uP8isSwJ6kIcPtM?= =?us-ascii?Q?XatJFomWfNhzSOKuz87J9wgmnxdU1uEWVbt4BP0ntR9iUWxtrRqX+WVxrDSP?= =?us-ascii?Q?FDj2CRH34puBThWgA8W/AyQ85/EpWr0z8/eL+75bbOd9bOaM2aTIVaT6d5Tl?= =?us-ascii?Q?AfJM/+dOqCsaqDhH2N5/ov7FerS4FbZSgjsRZzFkFnh9YfSU0ZrUmmEBKUnS?= =?us-ascii?Q?zdDLOlv8feAyru8huz68KNuz2oXFxaOhERmnccnDXNdu/+Y8EKkeWv37kynt?= =?us-ascii?Q?JzU7yxA4M3NPfF+M+fTQynps5drD50B/VKnvGBvbvFmz3GdSrPKkAjjkTgVf?= =?us-ascii?Q?YF/yS9oQvBleXG9vY4qIuGU4I/p5+CQKiBoF4CAoIJDw6LSe9hdS52229cuz?= =?us-ascii?Q?b/cbnqJXA0L22P7SBsywZ3XXoVqozra5cFIZJsgIQESBKh1+2Px25bicBPUy?= =?us-ascii?Q?rUMzWivP/9C1WGGzfYwsZ8tUjO5jd2bHUyL3gob+n0A/r8/152Tz87Sh8urY?= =?us-ascii?Q?qZYIR48tm/L0tyemgV6W/Lmx2W9E9nthVuU3pzUNlbxaKKgYwISkGZQ8HV6W?= =?us-ascii?Q?TTVdDD3Stby92aK5LN+dd+YSrvQdvFfOXFNGHkkI1OiCKU0qv41pJ+hqZtGg?= =?us-ascii?Q?GURlNDPQsLm/t/vlfYy1h63p+s/gO6HkS77klH3Mt91ME6AKtyNXxWqHDI7y?= =?us-ascii?Q?YI9oKr7m3PDNxLG4yOkaOnQfPvvRxdjsEk88CJwHmKfjXc4UBO4wZQmpBzBY?= =?us-ascii?Q?pvTatsHui7FHPdhFj3R4h3GwmYDVHoZewgBdubP5JI6IlGjj5DR1or19XtRD?= =?us-ascii?Q?xyeCruRM7UQ+feY2IE85LVL3lqZ5gZB4sJnWrj307VZ3FX2yq0jsM/j2W8kT?= =?us-ascii?Q?vZYxoCl1Z7igNUMl8MP+AkB53pQFvlAig1YKriDUVOJnF6V30kPwEDK1tbMl?= =?us-ascii?Q?OmVhnWRePUhUUoukQFxsaOzTAfUbRD/gnx+QA23PIwr06n+bJ1Iv7Dp7byDX?= =?us-ascii?Q?t/dv3AbRayGrHDVur57ZnlyO+dU/xWNTtrQI0fiBtnV7IEhDOik4UZQq65so?= =?us-ascii?Q?/rrAxr5jApA2aFKYy6eGNQLtOdoQboWwpHNc4YatnWq3MrMXnEQ/GQLY3r91?= =?us-ascii?Q?grGLZXYxHR86Lps/A9Oc3xmRmXC8CvgfZgTEZBc31msLYOkST5fukY7f5NVe?= =?us-ascii?Q?os1UnjK9VpApsguYV5tGLogl9hYnZv7/d5Ef2nN6aLqNyMxqLud7Fj3/6oLa?= =?us-ascii?Q?vMO4mUbm96dsGK39kG4k4srG4gA/PgQYhsMeKYVkiG4K1lETmHbG?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cb832d8-a0f5-485d-6177-08df4fc733d9 X-MS-Exchange-CrossTenant-AuthSource: MI3PR04MB12438.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 16:21:49.8192 (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: Otrg8Gpnaze/WFgUcrs+WbSBkLAqmeS9Wc0o4kAZZ7eifYd8a2xX7nB4TrJ7mmIPbjAdhFNhSf9ne9w7CCppR0xD6lN0e8k4gjA8ezKKDw+arA+97xYrFfOMOXZxeFIj X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7885 On Tue, Dec 01, 2026 at 11:26:46PM +0800, Jiaqi Shi wrote: > Remove control inheritance from pipeline subdevices to video nodes. > Userspace should access controls through subdev nodes instead. > > Use source-independent format ioctls for all capture nodes and > initialize them to the existing UYVY 640x480 default instead of the > source subdev active format. Keep stream-time format validation. > > Update the usage documentation and remove the completed TODO entries. > > Signed-off-by: Jiaqi Shi > --- > Documentation/admin-guide/media/imx.rst | 20 +- > drivers/staging/media/imx/TODO | 10 - > drivers/staging/media/imx/imx-ic-prpencvf.c | 10 +- > drivers/staging/media/imx/imx-media-capture.c | 401 +++++++----------- > drivers/staging/media/imx/imx-media-csi.c | 10 +- > .../staging/media/imx/imx-media-dev-common.c | 113 +---- > drivers/staging/media/imx/imx-media-utils.c | 9 +- > drivers/staging/media/imx/imx-media.h | 11 +- > 8 files changed, 177 insertions(+), 407 deletions(-) > > diff --git a/Documentation/admin-guide/media/imx.rst b/Documentation/admin-guide/media/imx.rst > index bb68100d8acb..812c6ac09ab8 100644 > --- a/Documentation/admin-guide/media/imx.rst > +++ b/Documentation/admin-guide/media/imx.rst > @@ -394,13 +394,9 @@ scaling up to 1024x1024, CSC, flip, and rotation: > Usage Notes > ----------- > > -To aid in configuration and for backward compatibility with V4L2 > -applications that access controls only from video device nodes, the > -capture device interfaces inherit controls from the active entities > -in the current pipeline, so controls can be accessed either directly > -from the subdev or from the active capture device interface. For > -example, the FIM controls are available either from the ipuX_csiY > -subdevs or from the active capture device. > +Controls for pipeline entities are accessed through their subdev device > +nodes. For example, the FIM controls are available from the ipuX_csiY > +subdevs. > > The following are specific usage notes for the Sabre* reference > boards: > @@ -483,7 +479,7 @@ NTSC, or 'alternate'): > media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480]" > media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]" > # Configure "ipu1_csi0 capture" interface (assumed at /dev/video4) > - v4l2-ctl -d4 --set-fmt-video=field=interlaced_bt > + v4l2-ctl -d4 --set-fmt-video=width=720,height=480,field=interlaced_bt > > Streaming can then begin on /dev/video4. The v4l2-ctl tool can also be > used to select any supported YUV pixelformat on /dev/video4. > @@ -510,7 +506,7 @@ alternating fields (field type 'seq-tb' for PAL, or 'alternate'). > media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]" > media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]" > # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2) > - v4l2-ctl -d2 --set-fmt-video=field=none > + v4l2-ctl -d2 --set-fmt-video=width=720,height=576,field=none > > Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be > used to select any supported YUV pixelformat on /dev/video2. > @@ -541,7 +537,7 @@ NTSC, or 'alternate'): > media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x480]" > media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]" > # Configure "ipu1_csi0 capture" interface (assumed at /dev/video0) > - v4l2-ctl -d0 --set-fmt-video=field=interlaced_bt > + v4l2-ctl -d0 --set-fmt-video=width=720,height=480,field=interlaced_bt > > Streaming can then begin on /dev/video0. The v4l2-ctl tool can also be > used to select any supported YUV pixelformat on /dev/video0. > @@ -568,7 +564,7 @@ alternating fields (field type 'seq-tb' for PAL, or 'alternate'). > media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]" > media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]" > # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2) > - v4l2-ctl -d2 --set-fmt-video=field=none > + v4l2-ctl -d2 --set-fmt-video=width=720,height=576,field=none > > Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be > used to select any supported YUV pixelformat on /dev/video2. > @@ -652,7 +648,7 @@ shows colorspace conversion and scaling at IC output. > media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]" > media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]" > # Set a format at the capture interface > - v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3 > + v4l2-ctl -d /dev/video1 --set-fmt-video=width=800,height=600,pixelformat=RGB3 > > Streaming can then begin on "ipu1_ic_prpenc capture" node. > > diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO > index 11c9e10d34ae..43cd030d4bbd 100644 > --- a/drivers/staging/media/imx/TODO > +++ b/drivers/staging/media/imx/TODO > @@ -1,13 +1,3 @@ > > - The Frame Interval Monitor could be exported to v4l2-core for > general use. > - > -- This media driver supports inheriting V4L2 controls to the > - video capture devices, from the subdevices in the capture device's > - pipeline. The controls for each capture device are updated in the > - link_notify callback when the pipeline is modified. This feature should be > - removed, userspace should use the subdev-based userspace API instead. > - > -- Similarly to the legacy control handling, legacy format handling where > - formats on the video nodes are influenced by the active format of the > - connected subdev should be removed. > diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c > index aaa2248780a8..979d124c19ea 100644 > --- a/drivers/staging/media/imx/imx-ic-prpencvf.c > +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c > @@ -203,7 +203,7 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct ipuv3_channel *ch) > > done = priv->active_vb2_buf[priv->ipu_buf_num]; > if (done) { > - done->vbuf.field = vdev->fmt.field; > + done->vbuf.field = vdev->stream_field; > done->vbuf.sequence = priv->frame_sequence; > vb = &done->vbuf.vb2_buf; > vb->timestamp = ktime_get_ns(); > @@ -362,6 +362,7 @@ static int prp_setup_channel(struct prp_priv *priv, > > memset(&image, 0, sizeof(image)); > image.pix = vdev->fmt; > + image.pix.field = vdev->stream_field; > image.rect = vdev->compose; > > /* > @@ -1279,13 +1280,13 @@ static int prp_registered(struct v4l2_subdev *sd) > > priv->vdev = imx_media_capture_device_init(ic_priv->ipu_dev, > &ic_priv->sd, > - PRPENCVF_SRC_PAD, true); > + PRPENCVF_SRC_PAD, true, true); > if (IS_ERR(priv->vdev)) > return PTR_ERR(priv->vdev); > > ret = imx_media_capture_device_register(priv->vdev, 0); > if (ret) > - goto remove_vdev; > + return ret; > > ret = prp_init_controls(priv); > if (ret) > @@ -1295,8 +1296,6 @@ static int prp_registered(struct v4l2_subdev *sd) > > unreg_vdev: > imx_media_capture_device_unregister(priv->vdev); > -remove_vdev: > - imx_media_capture_device_remove(priv->vdev); This part belong to bug fix, missed imx_media_capture_device_remove() at error path, user seperate patch to fix it. > return ret; > } > > @@ -1305,7 +1304,6 @@ static void prp_unregistered(struct v4l2_subdev *sd) > struct prp_priv *priv = sd_to_priv(sd); > > imx_media_capture_device_unregister(priv->vdev); > - imx_media_capture_device_remove(priv->vdev); why remove it here? > > v4l2_ctrl_handler_free(&priv->ctrl_hdlr); > } > diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c > index 9216a221b72f..2bd3f336b36b 100644 > --- a/drivers/staging/media/imx/imx-media-capture.c > +++ b/drivers/staging/media/imx/imx-media-capture.c > @@ -5,6 +5,7 @@ > * Copyright (c) 2012-2016 Mentor Graphics Inc. > */ > #include > +#include > #include > #include > #include > @@ -12,7 +13,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -35,16 +35,13 @@ struct capture_priv { > > struct v4l2_subdev *src_sd; /* Source subdev */ > int src_sd_pad; /* Source subdev pad */ > + bool ic_route; /* Source is an IC entity */ > > struct mutex mutex; /* Protect vdev operations */ > > struct vb2_queue q; /* The videobuf2 queue */ > struct list_head ready_q; /* List of queued buffers */ > spinlock_t q_lock; /* Protect ready_q */ > - > - struct v4l2_ctrl_handler ctrl_hdlr; /* Controls inherited from subdevs */ > - > - bool legacy_api; /* Use the legacy (pre-MC) API */ > }; > > #define to_capture_priv(v) container_of(v, struct capture_priv, vdev) > @@ -56,25 +53,33 @@ struct capture_priv { > * MC-Centric Video IOCTLs > */ > > +static enum imx_pixfmt_sel capture_format_sel(struct capture_priv *priv) > +{ > + return priv->ic ? PIXFMT_SEL_YUV_RGB : PIXFMT_SEL_ANY; > +} > + > static const struct imx_media_pixfmt *capture_find_format(u32 code, u32 fourcc) > { > const struct imx_media_pixfmt *cc; > + unsigned int i; > > cc = imx_media_find_ipu_format(code, PIXFMT_SEL_YUV_RGB); > if (cc) { > enum imx_pixfmt_sel fmt_sel = cc->cs == IPUV3_COLORSPACE_YUV > - ? PIXFMT_SEL_YUV : PIXFMT_SEL_RGB; > - > - cc = imx_media_find_pixel_format(fourcc, fmt_sel); > - if (!cc) { > - imx_media_enum_pixel_formats(&fourcc, 0, fmt_sel, 0); > - cc = imx_media_find_pixel_format(fourcc, fmt_sel); > - } > + ? PIXFMT_SEL_YUV : PIXFMT_SEL_RGB; > > - return cc; > + return imx_media_find_pixel_format(fourcc, fmt_sel); > } > > - return imx_media_find_mbus_format(code, PIXFMT_SEL_ANY); > + cc = imx_media_find_pixel_format(fourcc, PIXFMT_SEL_ANY); > + if (!cc || !cc->codes) > + return NULL; > + > + for (i = 0; cc->codes[i]; i++) > + if (cc->codes[i] == code) > + return cc; > + > + return NULL; > } > > static int capture_querycap(struct file *file, void *fh, > @@ -93,19 +98,24 @@ static int capture_querycap(struct file *file, void *fh, > static int capture_enum_fmt_vid_cap(struct file *file, void *fh, > struct v4l2_fmtdesc *f) > { > + struct capture_priv *priv = video_drvdata(file); > + > return imx_media_enum_pixel_formats(&f->pixelformat, f->index, > - PIXFMT_SEL_ANY, f->mbus_code); > + capture_format_sel(priv), > + f->mbus_code); > } > > static int capture_enum_framesizes(struct file *file, void *fh, > struct v4l2_frmsizeenum *fsize) > { > + struct capture_priv *priv = video_drvdata(file); > const struct imx_media_pixfmt *cc; > > if (fsize->index > 0) > return -EINVAL; > > - cc = imx_media_find_pixel_format(fsize->pixel_format, PIXFMT_SEL_ANY); > + cc = imx_media_find_pixel_format(fsize->pixel_format, > + capture_format_sel(priv)); > if (!cc) > return -EINVAL; > > @@ -136,39 +146,70 @@ static int capture_g_fmt_vid_cap(struct file *file, void *fh, > } > > static const struct imx_media_pixfmt * > -__capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose) > +__capture_try_fmt(struct capture_priv *priv, struct v4l2_pix_format *pixfmt, > + struct v4l2_rect *compose) > { > struct v4l2_mbus_framefmt fmt_src; > const struct imx_media_pixfmt *cc; > + enum imx_pixfmt_sel fmt_sel = capture_format_sel(priv); > + int ret; > > /* > * Find the pixel format, default to the first supported format if not > * found. > */ > - cc = imx_media_find_pixel_format(pixfmt->pixelformat, PIXFMT_SEL_ANY); > + cc = imx_media_find_pixel_format(pixfmt->pixelformat, fmt_sel); > if (!cc) { > imx_media_enum_pixel_formats(&pixfmt->pixelformat, 0, > - PIXFMT_SEL_ANY, 0); > + fmt_sel, 0); > cc = imx_media_find_pixel_format(pixfmt->pixelformat, > - PIXFMT_SEL_ANY); > + fmt_sel); > } > > - /* Allow IDMAC interweave but enforce field order from source. */ > - if (V4L2_FIELD_IS_INTERLACED(pixfmt->field)) { > - switch (pixfmt->field) { > - case V4L2_FIELD_SEQ_TB: > - pixfmt->field = V4L2_FIELD_INTERLACED_TB; > - break; > - case V4L2_FIELD_SEQ_BT: > - pixfmt->field = V4L2_FIELD_INTERLACED_BT; > - break; > - default: > - break; > - } > + switch (pixfmt->field) { > + case V4L2_FIELD_ANY: > + pixfmt->field = V4L2_FIELD_NONE; > + break; > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + case V4L2_FIELD_ALTERNATE: > + break; > + default: > + pixfmt->field = V4L2_FIELD_NONE; > + break; > } > > + /* Clamp dimensions to prevent zero-sized buffers. */ > + pixfmt->width = clamp(pixfmt->width, 1, 65535); > + pixfmt->height = clamp(pixfmt->height, 1, 65535); > + > v4l2_fill_mbus_format(&fmt_src, pixfmt, 0); > - imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc); > + if (cc->cs == IPUV3_COLORSPACE_RGB && > + fmt_src.quantization == V4L2_QUANTIZATION_DEFAULT) > + fmt_src.quantization = V4L2_QUANTIZATION_FULL_RANGE; > + imx_media_try_colorimetry(&fmt_src, priv->ic_route); > + > + ret = imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc); > + if (ret) { > + u64 divisor = (u64)pixfmt->bytesperline * > + (cc->planar ? cc->bpp : 8); > + > + if (!divisor) > + return NULL; > + > + fmt_src.height = div64_u64((u64)U32_MAX * 8, divisor); > + if (!fmt_src.height) > + return NULL; > + > + pixfmt->height = fmt_src.height; > + ret = imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc); > + if (ret) > + return NULL; > + } > > if (compose) { > compose->width = fmt_src.width; > @@ -181,7 +222,11 @@ __capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose) > static int capture_try_fmt_vid_cap(struct file *file, void *fh, > struct v4l2_format *f) > { > - __capture_try_fmt(&f->fmt.pix, NULL); > + struct capture_priv *priv = video_drvdata(file); > + > + if (!__capture_try_fmt(priv, &f->fmt.pix, NULL)) > + return -EINVAL; > + > return 0; > } > > @@ -196,10 +241,13 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh, > return -EBUSY; > } > > - cc = __capture_try_fmt(&f->fmt.pix, &priv->vdev.compose); > + cc = __capture_try_fmt(priv, &f->fmt.pix, &priv->vdev.compose); > + if (!cc) > + return -EINVAL; Can you split to more small patches, such as just add priv for __capture_try_fmt() Frank