Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7288932rwd; Mon, 19 Jun 2023 22:13:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6N4b89+80slgUskggzSoeqTYKeouIyxAgSQtjyzxpwbsazEEvVJDnEZ6H5ve000XAKK0AE X-Received: by 2002:a92:c10e:0:b0:335:7be2:26ca with SMTP id p14-20020a92c10e000000b003357be226camr10723834ile.19.1687237998210; Mon, 19 Jun 2023 22:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687237998; cv=none; d=google.com; s=arc-20160816; b=XszfsB0TjxG3vnnM4p2bp4YjzfvNJXm9/72giW7i+XAGnJMnPXu64r1Fhf3D1NOHUR v+io71nnEjgKfNnbm3P+i7ZAUTEUVeWb2T1TIMdNZ0bN9o2EYGaQJjems7Tf6Sr3/pVM I2FsfDqeK5Fut0o2xi4cVNTIOHwWlOiSQHEkGMGWB2nvSokLOk+N0271QjFQL6QwiyNc dBEAXW6UWIxgM3x/XZu6S1DRnrdeSW/Zf/D0c/YgagX8n6G9NtJYHla3sfQylFKBfUzC mgsuSXFc8aS2E5hbk65WSKRgPS7nRDaoYWQTmnZH4B+HolRM/Vgqh2eMnxl5dWa8x9cM A7RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UQhBYvgvjJaBu+x58O4y0fjxZr52NtNh3QoxohJM54o=; b=aDxLEsusePTFX3z+tY2VuPhRGG8CeL6fIaMiCKbqw7xLigp9YrqtKXFZvCw0x+Jd0t lN5pt+6Z6nSfIWVUY20ZDEu1/m2plvMo/xbocf9BrUzBtVdUr2geKd/aEH18PN7NMFqO DBe9GCVEt7CLn8H04832nG5yLJzBm8G8xPlKm1mbb2WTtKRQC1/GjV9mUIrJZKB/TXsT VcNIChiUeNKX3kMsqDlN5Z+E/YTnlZyFaT+288KE2uMzUuBJ7Y3Q8AMShqVYpOWy3NWU 6OUgeDMPGzAvJKFF64/l/jP0HEc4eyROKqyV0TsKuiv+TP0UVCinJoHDkAsYJ0+isB7e d+bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n8SAn7pI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q62-20020a632a41000000b0052c54de0299si987495pgq.637.2023.06.19.22.13.06; Mon, 19 Jun 2023 22:13:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=n8SAn7pI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbjFTEz1 (ORCPT + 99 others); Tue, 20 Jun 2023 00:55:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjFTEz0 (ORCPT ); Tue, 20 Jun 2023 00:55:26 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFDC1F1; Mon, 19 Jun 2023 21:55:22 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-977e0fbd742so583746166b.2; Mon, 19 Jun 2023 21:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687236921; x=1689828921; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UQhBYvgvjJaBu+x58O4y0fjxZr52NtNh3QoxohJM54o=; b=n8SAn7pIaY9D4f2HuKiL5LTlAaKgpYXgbxz9ZWc3NWeFlSlBmZdb4aSenvBmvk6fRA V6JYKo3icscEiKGlshmBEHx2Vm+e9YOBLl/r1maZK6poSPca9ulN5/Uctz4mGms+uxx9 vc1yMKHCHxhOnJU085tX4Qybh4ipAZ6pYbRdAKlGeVOioJvhgknpwpLAUBrDGs3Phv12 hao8nSLjb1LXKZk1bwztuBxn3xs68lM8sGZHzc8reOLx3Yw5dT+HtuVnIN6k0HoAPaKG fKvhvr/zHZ9r/oMl2JqUxgBTMasHAWo7u+IHOcXfMm/e/ikV+5AS9fRso2LQ9SdnalK6 amWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687236921; x=1689828921; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UQhBYvgvjJaBu+x58O4y0fjxZr52NtNh3QoxohJM54o=; b=flq9DMn5KXb4F/4XVwjmbhx6yAEH3qxzrhqQi0MOoE0uRcPFAvWaDtpoCe5VIihDZ9 p1XWcEu5aHJau0hEkBsKKXtyWNk0tn7L0W/PWY+71zf/+w1nwDLAEGZWKgdngeL/p0oS UpomUr9GNG+/28IHg+qtY0FDnP5d0gQWrmzTuK3DevLG+SATuee+FFHRTiSrluVeAEr/ y4RR+R6wtH1THPQFHAGcUWDw8FP0aqdd8rjzBXtzvUjvbGA7KmAvzZZh0YdLQ0pqbTJE Gs/M1sRgTswO3wKSXFBLa0DOc7Ems7qkRJRK8OPywKOVXtJv3NgB1kDxVRsZvM36ZVjB vnWw== X-Gm-Message-State: AC+VfDw+e68XxYOgpyo4cnRJ8ZVyXNhlAsSaObkk6EoEsV5mxSIoElOl LrhojS1goO7VckY4oLqXt3w= X-Received: by 2002:a17:906:f8cb:b0:975:3037:b7bc with SMTP id lh11-20020a170906f8cb00b009753037b7bcmr7305682ejb.30.1687236920871; Mon, 19 Jun 2023 21:55:20 -0700 (PDT) Received: from tom-HP-ZBook-Fury-15-G7-Mobile-Workstation ([37.159.32.100]) by smtp.gmail.com with ESMTPSA id rh8-20020a17090720e800b0098282bb8effsm610626ejb.196.2023.06.19.21.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 21:55:20 -0700 (PDT) Date: Tue, 20 Jun 2023 06:54:43 +0200 From: Tommaso Merciai To: Laurent Pinchart Cc: Sakari Ailus , jacopo.mondi@ideasonboard.com, martin.hecht@avnet.eu, michael.roeder@avnet.eu, linuxfancy@googlegroups.com, Mauro Carvalho Chehab , Liam Girdwood , Mark Brown , Hans Verkuil , Marco Felsch , Gerald Loacker , Nicholas Roth , Krzysztof =?utf-8?Q?Ha=C5=82asa?= , Linus Walleij , Benjamin Mugnier , Mikhail Rudenko , Shawn Tu , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH v5 3/3] media: i2c: Add support for alvium camera Message-ID: References: <20230608083127.545750-1-tomm.merciai@gmail.com> <20230608083127.545750-4-tomm.merciai@gmail.com> <20230619142458.GE10462@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230619142458.GE10462@pendragon.ideasonboard.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, Sakari, On Mon, Jun 19, 2023 at 05:24:58PM +0300, Laurent Pinchart wrote: > On Mon, Jun 19, 2023 at 10:50:10AM +0000, Sakari Ailus wrote: > > On Fri, Jun 09, 2023 at 03:09:41PM +0200, Tommaso Merciai wrote: > > > On Fri, Jun 09, 2023 at 09:17:42AM +0000, Sakari Ailus wrote: > > > > On Thu, Jun 08, 2023 at 10:31:16AM +0200, Tommaso Merciai wrote: > > > > > The Alvium camera is shipped with sensor + isp in the same housing. > > > > > The camera can be equipped with one out of various sensor and abstract > > > > > the user from this. Camera is connected via MIPI CSI-2. > > > > > > > > > > Most of the camera module features are supported, with the main exception > > > > > being fw update. > > > > > > > > > > The driver provides all mandatory, optional and recommended V4L2 controls > > > > > for maximum compatibility with libcamera > > > > > > > > > > References: > > > > > - https://www.alliedvision.com/en/products/embedded-vision-solutions > > > > > > > > > > Signed-off-by: Tommaso Merciai > > > > > --- > > > > > Changes since v2: > > > > > - Removed gpios/clock handling as suggested by LPinchart > > > > > - Added vcc-ext-in supply support as suggested by LPinchart > > > > > - Fixed alvium_setup_mipi_fmt funct as suggested by CJAILLET > > > > > - Removed upside_down/hshake_bit priv data as suggested by CJAILLET > > > > > - Fixed commit body as suggested by LPinchart > > > > > - Mv alvium_set_streamon_delay to yalvium_set_lp2hs_delay > > > > > - Fixed comment on lp2hs prop as suggested by LPinchart > > > > > - Added pm resume/suspend functs as suggested by LPinchart > > > > > - Dropped alvium_link_setup/alvium_s_power as suggested by LPinchart > > > > > - Fixed regs defines as suggested by LPinchart > > > > > - Fixed typedef as suggested by LPinchart > > > > > - Dropped bcrm_v/fw_v from priv data as suggested by LPinchart > > > > > - Now driver use the subdev active state to store the active format and crop > > > > > as suggested by LPinchart > > > > > - Dropped alvium_is_csi2/i2c_to_alvium as suggested by LPinchart > > > > > > > > > > Changes since v3: > > > > > - Fixed warnings Reported-by: kernel test robot > > > > > > > > > > Changes since v4: > > > > > - Removed print into alvium_get_dt_data for alliedvision,lp2hs-delay-us as > > > > > suggested by CDooley > > > > > > > > > > drivers/media/i2c/Kconfig | 10 + > > > > > drivers/media/i2c/Makefile | 1 + > > > > > drivers/media/i2c/alvium-csi2.c | 3479 +++++++++++++++++++++++++++++++ > > > > > drivers/media/i2c/alvium-csi2.h | 485 +++++ > > > > > 4 files changed, 3975 insertions(+) > > > > > create mode 100644 drivers/media/i2c/alvium-csi2.c > > > > > create mode 100644 drivers/media/i2c/alvium-csi2.h > > [snip] > > > > > > diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c > > > > > new file mode 100644 > > > > > index 000000000000..52c9263075cf > > > > > --- /dev/null > > > > > +++ b/drivers/media/i2c/alvium-csi2.c > > > > > @@ -0,0 +1,3479 @@ > > [snip] > > > > > > +static int alvium_get_img_width_params(struct alvium_dev *alvium) > > > > > +{ > > > > > + struct device *dev = &alvium->i2c_client->dev; > > > > > + int ret; > > > > > + u64 val; > > > > > + > > > > > + if (!alvium->bcrm_addr) > > > > > + return -EINVAL; > > > > > + > > > > > + ret = alvium_read(alvium, > > > > > + REG_BCRM_IMG_WIDTH_MIN_R, > > > > > + &val); > > > > > + if (ret) { > > > > > + dev_err(dev, "Fail to read img min width reg\n"); > > > > > + return ret; > > > > > + } > > > > > > > > Could you add a macro that assigns the value to the variable (or a struct > > > > field in this case) when the read is successful? Add the print if you think > > > > you need it. > > > > > > I don't get this comment. > > > Can you explain me better your plan please. > > > > You have exactly the same pattern repeated over and over in a number of > > functions. I'd like you to add a macro (or a function) that takes what > > varies as arguments, and call that function here. It would reduce a lot of > > the repeated lines code here. > > > > ... > > The best option is to print an error message in alvium_read() and drop > all error messages from the callers. What about don't print anything? We already have prints that comes from CCI API if some errors occurs. Laurent suggest me this into some previous comments. Let me know. Thanks & Regards, Tommaso > > -- > Regards, > > Laurent Pinchart