Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp504452lqp; Tue, 11 Jun 2024 10:26:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvs6khgg71SLfWHBXUnysctZkCRwrMzScpjhmz4RUZbYtEyqXcvQUEo+pG8GWh5MWb7zmxtGsvk7gZHBIL2r4s3RA7Q08LP2P0e/TSIg== X-Google-Smtp-Source: AGHT+IGAfSr3eLgMqcbqaSsf0OJ8Si5j/ST975vWnLCdJ528qPqNuM4u9G5iV9o6FI/UuxDh5Xvn X-Received: by 2002:a17:906:2b52:b0:a6f:1473:379c with SMTP id a640c23a62f3a-a6f1473387cmr450555666b.45.1718126777891; Tue, 11 Jun 2024 10:26:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718126777; cv=pass; d=google.com; s=arc-20160816; b=IwCc2Bh2LovhcsTusRhz4sv0hBbXa+bqKzThH/K/jeJi2YVnGue9Xky40jr9R+inRO 3AlPKee4lZYHXVLzTwGCqhX04PlqU7D1c9QBSH0Xf4EJQgicxPa6+xLD5iVyD6+dcxS3 7Oy1pFllLiq0kc5u+DKE9ZVhDz73bjQ0AuWrzf+LnkD1WV96TPdfiP6X1hRYE/GqXSQq o7bXatwas6xLu4enRfa4akY/6Fzco1V5rh/auJdOgEvQLsyTax5KnNEA/W7jjdc6SyPw Mkfer1It/lM8Jvvgm31eiD0Wx6HTdWrq1R+yMMNoqZeSv8HWW6S1C0vvbmvVDJGZ34LV JA/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HiAP3+Ec5hrm6yQRRHqP09xttz6ueK0PRlnBsUBLqPg=; fh=fmYHXa6bdjDS5TuzVrdTizXjZS5BSgVuZVsHFuNNxqo=; b=easoWBEpfzUhtn8w+CgZXn+Sv2TQJaSUC0MhhVcDzKqWU5vQguY4OCSkObKKay8v0f bldXzhFClpoWB+Diz/yodhR2fJOMibdP2t6cREFM0euhlUT/ujunu62AL3ibTMIWTKcS z6AITbtFJEDTDiWxjxXrp9BFQFSx+i4Nbg02lA5jqfUKcw+Z6Uet+vCZmTaxEFXWZ40Z 7mzPXSaYNLYcRHsfrWC92EoDk7vlayJBv9k07r/pw1u1axRuzVM1m5t5CbdPHYB1qRxb AqAYXQfd1ljp4SXE3b3NtE5iU5zGBK1c0kiynl+VPvotlKaGlfWX32KSv0UbrKXfGsBG LdOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c2suFtL5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f17c7938esi273034766b.1010.2024.06.11.10.26.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 10:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c2suFtL5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 70D981F24C1B for ; Tue, 11 Jun 2024 17:26:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D11F4F88C; Tue, 11 Jun 2024 17:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c2suFtL5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6006147F5D; Tue, 11 Jun 2024 17:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718126765; cv=none; b=kfKeGubXX9dkkvYUewMu6qZW943Zv3HTcyf5Keap1xAx6oumHzdP8LcLCXUR6xe6oVtKhkSSjZ40YbeFVcuqzE/lmwx4Ayth8ESP04g0gXnaOgNhcsHAHjOONV9+OKFg7JHyzmKBb8CcKCGtWuVCjVZfXFr9kUz0WCCHrbhcr9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718126765; c=relaxed/simple; bh=SQVKiWoMEQlGJzZl2xfryE32TSjR7fWPakYa+xG+jOQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c1dG7UpfJDzgAT01vG4M47RuSnTlUpkHxeYpayHXFxdfwUQxl4Sifji/1W8lafjk8PR5v9cJsMsaIXBpiTTjauhu1qdxNlUOWit9q8kDl96kc9VZAbFfBtNHIPbrQMABripC1omNPqmZazJIzBpJ39l+nsN53PDBX6fD2v//QO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c2suFtL5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CECECC2BD10; Tue, 11 Jun 2024 17:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718126764; bh=SQVKiWoMEQlGJzZl2xfryE32TSjR7fWPakYa+xG+jOQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c2suFtL5Vem76e++QV+lrZeQ7MGiZxVNYh58xkSQi2PPsLfzgMS+DIViYpPHwQIIF OQsYe+Y8zKrquo+xzNMcQu6lXzyiUATsppSouXRBdVURX2p/4tkeyTY8YA3VjNSpRq F64+77bYB6rnQpQt6afrIzUOf6dOR6B4sXGhn7UVKtUTB8MLQAEFpwkuEtLMEi5GDu HRy6oaJUJJdwjklzdWv+LgNpsX8DPiNzS9u2kLYOXfEPTvmV8CzRmlgvdhLcfUbiza CAmlUqVumeZrj5/6o682Y84/8n7jfxQeLepnQGIcQ1Xm+1hE6nkCG3V6dye3Leykmi 1MBzCTM49UwkA== Date: Tue, 11 Jun 2024 10:26:02 -0700 From: Nathan Chancellor To: Umang Jain Cc: Mauro Carvalho Chehab , Conor Dooley , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sakari Ailus , Kieran Bingham , Rob Herring , Krzysztof Kozlowski , Sascha Hauer , Andy Shevchenko , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v4 2/2] media: i2c: Add imx283 camera sensor driver Message-ID: <20240611172602.GA2226028@thelio-3990X> References: <20240402-kernel-name-extraversion-v4-0-fb776893e4ec@ideasonboard.com> <20240402-kernel-name-extraversion-v4-2-fb776893e4ec@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240402-kernel-name-extraversion-v4-2-fb776893e4ec@ideasonboard.com> Hi Umang, On Tue, Apr 02, 2024 at 03:37:51PM +0530, Umang Jain wrote: > From: Kieran Bingham > > Add a v4l2 subdevice driver for the Sony IMX283 image sensor. > > The IMX283 is a 20MP Diagonal 15.86 mm (Type 1) CMOS Image Sensor with > Square Pixel for Color Cameras. > > The following features are supported: > - Manual exposure an gain control support > - vblank/hblank/link freq control support > - Test pattern support control > - Arbitrary horizontal and vertical cropping > - Supported resolution: > - 5472x3648 @ 20fps (SRGGB12) > - 5472x3648 @ 25fps (SRGGB10) > - 2736x1824 @ 50fps (SRGGB12) > > Signed-off-by: Kieran Bingham > Signed-off-by: Umang Jain This change is now in -next as commit ccb4eb4496fa ("media: i2c: Add imx283 camera sensor driver"). > +++ b/drivers/media/i2c/imx283.c ... > +/* IMX283 native and active pixel array size. */ > +static const struct v4l2_rect imx283_native_area = { > + .top = 0, > + .left = 0, > + .width = 5592, > + .height = 3710, > +}; > + > +static const struct v4l2_rect imx283_active_area = { > + .top = 40, > + .left = 108, > + .width = 5472, > + .height = 3648, > +}; ... > +#define CENTERED_RECTANGLE(rect, _width, _height) \ > + { \ > + .left = rect.left + ((rect.width - (_width)) / 2), \ > + .top = rect.top + ((rect.height - (_height)) / 2), \ > + .width = (_width), \ > + .height = (_height), \ > + } ... > + .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), This construct does not work with GCC prior to 7 and Clang prior to 17 (where certain const structures and variables will be considered constant expressions for the sake of initializers and such), resulting in: drivers/media/i2c/imx283.c:443:30: error: initializer element is not constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:412:11: note: in definition of macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: note: (near initialization for 'supported_modes_12bit[0].crop.left') .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:412:11: note: in definition of macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: error: initializer element is not constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:413:10: note: in definition of macro 'CENTERED_RECTANGLE' .top = rect.top + ((rect.height - (_height)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: note: (near initialization for 'supported_modes_12bit[0].crop.top') .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:413:10: note: in definition of macro 'CENTERED_RECTANGLE' .top = rect.top + ((rect.height - (_height)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: error: initializer element is not a compile-time constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:412:11: note: expanded from macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:492:30: error: initializer element is not a compile-time constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:412:11: note: expanded from macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. with these compiler versions. Usually, the values are just refactored with #define macros. Cheers, Nathan