Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp555975lql; Mon, 11 Mar 2024 10:11:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVv3JjuWYH80sTbCpFYQZSEfFvn+rxm74kD/vMRSAJniMaWzOFhgaK5IhUNxzDnu8qe6kLURieU+A0dYfiM79piRrnOqmt20H5EY0obxA== X-Google-Smtp-Source: AGHT+IFwUnZwiS4VRC35lO3qrYt2g0wF3jkyH/wKhGvuNE9nD0JaYNlJwuw7iJsueO/3eLNnRtNi X-Received: by 2002:a17:903:1c7:b0:1dd:7d66:b440 with SMTP id e7-20020a17090301c700b001dd7d66b440mr7574543plh.35.1710177080030; Mon, 11 Mar 2024 10:11:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710177080; cv=pass; d=google.com; s=arc-20160816; b=L+12nMFoaD0y6pY5mQc1W4W/iFpmEIU8NQjpAorGEcIetBqjgdVat+mOHGgnldKGCB 2c5pvbP79YoVQNaCS5Cid8DYsO1cMtEGt+R9V9r7TdYx2kknyXX2vs4YK9EaYGWFJF1P UZQky2ZV/9xRmonT9+O7lMt6EpHqcxlEh0+5mM5fWCB0RhypIfQtcAa/deiiUlvS7Msq CplO7/1guYZAnOJnTFlTtrSFlJXGxcbob0iJO56X0Z6NQTUX5bWufKi2o5RJJCngnJu9 0si5YPdxhxzmCf6KyTj2LyrWYKm3UHLbsPPyUUNVCpXZO20gQbmREaW0ocJJfSDeklg8 5xQQ== 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=dhxxW2/9n4JHYzVB2JSq41hRSiYd4uoc1lbTJ6tov20=; fh=I9XkPcNvrowZHvbn0iQhkFqM8cY6kUmSxF3Hvkx77rQ=; b=H8qOh5nNunAws4lyy0yTCMIHAmxJjeO++/IdXK1ieybzuul92+NvNYfH9Mk2O09SDo PghpS6rqK8LXYeCji3OJxz8HVaiuxM31AmRFIPUuv9Y0A3Oewg7giJmZWPWRpksKKxZr u9W9IH3Vj2KMEbhxLSKZRFmONIpkD959tu/4fyxVIUUhy9eaD/AjjTdXGyOC+g50JiTQ DBoqh56RanXvTWN9WpgeyzxU8QhfozEX6K4BIwK18BuhML8LxnBV+xAaMTSlY3IDH1OL RkjOu7sGE7+LzdTRrP6RRFrAqY23+NPPRezf6GMxz0vtYVHzUuFS5u/ZY9HhkjyPsVvM tUbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="g8ju/OH8"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-99291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99291-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o6-20020a170902778600b001dd5bc8ae32si5124204pll.242.2024.03.11.10.11.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="g8ju/OH8"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-99291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99291-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B4471281E48 for ; Mon, 11 Mar 2024 17:11:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27DAC4D9E6; Mon, 11 Mar 2024 17:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g8ju/OH8" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 DD5C33BB29; Mon, 11 Mar 2024 17:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710177066; cv=none; b=Rkm+Nyeg2J72lmCqSW4D3yqMj9w+5tzzLwkzXQ7hzCi5Vo/zuT7O1iicR1cD//NJkB4zsNP/3c9EvpUo12O314vB4w5HL8OT6n+GTPcArEZYbuK7MyK07cfnB5s8OvcHqGtjY627KrjXU+lgC4JcSLbBcZ7VTeOFqmD37cIWGUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710177066; c=relaxed/simple; bh=SnWDqsNR8fmTdDjQzqXGo9Y1BV3aJUfcIxhmuN3gCeY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vd71HvyEb4FGYfnlFImEYrzFomFphiggLg/56lzLzeGBn5FZ60JJcs4CLDt4JAkndvk86xNImVKXkx5ScYswXl/WOWyYSlkO4XpHAZbV7Vbfz+vmhdRf37MYhxt1FjUM2sSvSbR4iq+dlaKT4q3TvKqpVAmquMMhPBx0b4jh5+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=g8ju/OH8; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710177063; x=1741713063; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=SnWDqsNR8fmTdDjQzqXGo9Y1BV3aJUfcIxhmuN3gCeY=; b=g8ju/OH8GcMWiTHLqg9wqys/Oo9zwXjmOLBOgS1j4U0MO+tXLony16PK +Vji5IXB5nLU521ONnS8JP0YViK4QU3D+eocrTbCcBRtggID1UiAM0xtL JRGK9sPWFb6gg8r+3v+3mT/8uq304uB3tVIvkfz1xjGF+JVYtx9HFqNIv fN2wDszntwwFo8I4xXhf9LhZFpaAQxFNJ9sytPY/vZe0cZ6iffmv5PKLE ZvkSzwYArhnDoF6jWysvv7VEPoJYCFDqBO2mObRG4ZsbMCeNmxW3bGSvG 5gljO2fCrKQvAPNaoWsP+Y4FQyHryHICA6AabCUDK2SKXEB2nn5OXPreA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="30297475" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="30297475" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 10:11:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="42150015" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 10:10:57 -0700 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 322D711FCAC; Mon, 11 Mar 2024 19:10:55 +0200 (EET) Date: Mon, 11 Mar 2024 17:10:55 +0000 From: Sakari Ailus To: Kieran Bingham Cc: Umang Jain , linux-media@vger.kernel.org, Laurent Pinchart , willl will , Mauro Carvalho Chehab , Hans Verkuil , Hans de Goede , Tomi Valkeinen , Alain Volmat , Paul Elder , Mehdi Djait , Bingbu Cao , Andy Shevchenko , Sebastian Reichel , Jacopo Mondi , open list Subject: Re: [PATCH v2 2/2] media: i2c: Add imx283 camera sensor driver Message-ID: References: <20240307214048.858318-1-umang.jain@ideasonboard.com> <20240307214048.858318-3-umang.jain@ideasonboard.com> <171016009901.2924028.16001544322304093037@ping.linuxembedded.co.uk> <171017536692.2924028.6522729664515712567@ping.linuxembedded.co.uk> 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: <171017536692.2924028.6522729664515712567@ping.linuxembedded.co.uk> Hi Kieran, On Mon, Mar 11, 2024 at 04:42:46PM +0000, Kieran Bingham wrote: > Quoting Sakari Ailus (2024-03-11 16:29:23) > > Hi Kieran, > > > > On Mon, Mar 11, 2024 at 12:28:19PM +0000, Kieran Bingham wrote: > > > Hi Sakari, Umang, > > > > > > I've replied inline below to a couple of points that I was responsible for. > > > > > > > > > > > > + > > > > > +struct imx283 { > > > > > + struct device *dev; > > > > > + struct regmap *cci; > > > > > + > > > > > + const struct imx283_input_frequency *freq; > > > > > + > > > > > + struct v4l2_subdev sd; > > > > > + struct media_pad pad; > > > > > + > > > > > + struct clk *xclk; > > > > > + > > > > > + struct gpio_desc *reset_gpio; > > > > > + struct regulator_bulk_data supplies[ARRAY_SIZE(imx283_supply_name)]; > > > > > + > > > > > + /* V4L2 Controls */ > > > > > + struct v4l2_ctrl_handler ctrl_handler; > > > > > + struct v4l2_ctrl *exposure; > > > > > + struct v4l2_ctrl *vblank; > > > > > + struct v4l2_ctrl *hblank; > > > > > + struct v4l2_ctrl *vflip; > > > > > + > > > > > + unsigned long link_freq_bitmap; > > > > > + > > > > > + u16 hmax; > > > > > + u32 vmax; > > > > > +}; > > > > > + > > > > > +static inline struct imx283 *to_imx283(struct v4l2_subdev *_sd) > > > > > +{ > > > > > + return container_of(_sd, struct imx283, sd); > > > > > > > > It's a function, you can call _sd sd instead. > > > > > > Except then that could 'look' like it is passed as the first and third > > > argument to container_of... > > > > It's really a non-issue: the third argument is a field name, not a > > variable. > > That's not so easy to determine when the args are the same name.., but > it's fine with me either way. > > > > But if it's fine / accepted otherwise then sure. > > > > And please use container_of_const(). :) > > Ack. Or rather ... I'll leave that to Umang to handle, as he's managing > this driver now. > > > > > > + > > > > > +/* Determine the exposure based on current hmax, vmax and a given SHR */ > > > > > +static u64 imx283_exposure(struct imx283 *imx283, > > > > > + const struct imx283_mode *mode, u64 shr) > > > > > +{ > > > > > + u32 svr = 0; /* SVR feature is not currently supported */ > > > > > > > > What does this refer to? I guess you could just drop it as well if it's not > > > > supported? > > > > > > Keeping this will keep the calculation matching the datasheet, and > > > provide clear value for what to update when we/others return to enable > > > long exposures. > > > > > > So it would be nice to keep as it sort of documents/tracks the > > > datasheet. > > > > Ack. > > > > > > > > > > > > > + u32 hmax = imx283->hmax; > > > > > + u64 vmax = imx283->vmax; > > > > > > > > You're not changing the values here. I wouldn't introduce temporary > > > > variables just for that. > > > > > > > > > + u32 offset; > > > > > + u64 numerator; > > > > > + > > > > > + /* Number of clocks per internal offset period */ > > > > > + offset = mode->mode == IMX283_MODE_0 ? 209 : 157; > > > > > > > > Shouldn't this be in the mode definition? > > > > > > It could be, but then there would be one copy of 209, and 9 copies of > > > 157. > > > > That would still be specified explicitly. Someone adding a new mode would > > easily miss this. > > > > Or, if you can, derive this from something else that is now a part of the > > mode itself. > > I don't understand the above, other than ... That's exactly what we're > doing here. Index of the mode, not the mode itself. They're different. > > *Only* MODE_0 has an offset of 209 in the datasheet. All other modes are > 157. > > This is the table being codified: > https://pasteboard.co/OsKf4VX7rtrS.png Ok, fine by me. Maybe a comment at the end of the mode list to check this when adding new modes? There are other sources of modes than the datasheet. -- Sakari Ailus