Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8868284rwi; Tue, 25 Oct 2022 11:52:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZBk/y6BZLZgFUBObA0rUAMbpQiRZdg/r9Bzb/m/vLRgALjc1TJKzQXSoXGQvP4tDMmkSz X-Received: by 2002:a17:907:2c74:b0:7a1:d333:f214 with SMTP id ib20-20020a1709072c7400b007a1d333f214mr15952314ejc.14.1666723964286; Tue, 25 Oct 2022 11:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666723964; cv=none; d=google.com; s=arc-20160816; b=F/633a52H6GIZzNmmHQj0l9km/QV046AgL7fM1MFm82+AStoz04pWEheOKNkdOn1iS xk3r1eob5C+LiKYIifFWGg/6yxiygm0+lwn8RHAA1AafIFxFHqgo5W2H3RRbdly5IcC1 fEhZ+u/S3ntwf3Um6QZImEUGJuC9Pl8kjoDJArVTZBmQ4t8rA6ylUPzonIYaxwv5Cua7 aqI4w2Y3HjAx53tl6loMRez2u+dtaoK9IJmo/05k+xu7u1Ezlkkvrj7xowo4J69gKBUe jW3pJpE+7F2MkSO9umf+MhaFPra31B6iL4e0LUPLzEMnLDA4AOdAHI3UddY1hL1QOLi0 s+Kg== 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=66VKc2VMT/jF1tUAMh9bkyeQYU1ea9SLCNGAtvypSqU=; b=cSIXQBQI2/3tXGpUoqPA24CwgNLjaII5Y3/tzchujnP8MNFJ+ortZZVGtDGVYjwqey v3fyeg2mu9e6DNZKVXcUgLYxMWM/IpWR0YKk8p63GOMbCeCeAdkTfljzC2LNexyfgOde Vxg/dBJBer8Xn4XoVzkp2v/bvdE/P4Fav2jBraSXu5T+EQNncFCl1NU1J+qpkHT5E9bA pV2fOUaDN6RJLQwl0rMYKeaoHUf7lmA5cpGYDimzJb5FCgEjrKniRRREV2pz9dhddl2+ tDoEK/1obQgSYX6smD0fziLi9LSxf9UxJJscj9UbE8isRworTcpa5lVvs0M1xReAPybZ mKSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JJiYCWUG; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh11-20020a1709076e8b00b0078d288c1047si3282579ejc.841.2022.10.25.11.52.18; Tue, 25 Oct 2022 11:52:44 -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=@intel.com header.s=Intel header.b=JJiYCWUG; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232621AbiJYSHu (ORCPT + 99 others); Tue, 25 Oct 2022 14:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232664AbiJYSHf (ORCPT ); Tue, 25 Oct 2022 14:07:35 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436B331359; Tue, 25 Oct 2022 11:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666721243; x=1698257243; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=VOpBFPiXCf+5fX6cR64v+oy3Xni2HfEQZgB+4zR/DtE=; b=JJiYCWUGCCggS5hAAwpTiO3sPrDml0Z3DEcgWMYSUrlQp4q2+LdLJp6M qyT0nnB6sowG9rSzhj3moh8yyD+P0NemxiaSizSPM+mU/RTfrE+csKDH3 AW+CRqH04yA+oydcBaEQwmzvCPPd3e2ZKErWzYo5nGEN7oiHuGitzFae/ 3DNWWaxnAgIKUoue0X+Cc8v57HJAZLhQakrE73D5UtGQN8UV7Nr+hfZG8 wQIbbCZQkF10NLy1yRoy6qf1H9ogiAEacmru+HfcCa7I7qCszvaGD2R/K vy7J3/EHLcVMYwxyYEY2kUq1ULVCa9aOt4eWlCDTmEgM84vFDMnR15tvE Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10511"; a="306483283" X-IronPort-AV: E=Sophos;i="5.95,212,1661842800"; d="scan'208";a="306483283" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 11:07:22 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10511"; a="631722499" X-IronPort-AV: E=Sophos;i="5.95,212,1661842800"; d="scan'208";a="631722499" Received: from punajuuri.fi.intel.com (HELO paasikivi.fi.intel.com) ([10.237.72.43]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 11:07:18 -0700 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id 85AFE2026C; Tue, 25 Oct 2022 21:07:16 +0300 (EEST) Date: Tue, 25 Oct 2022 18:07:16 +0000 From: Sakari Ailus To: Jacopo Mondi Cc: Mikhail Rudenko , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Shawn Tu , Laurent Pinchart , Hans Verkuil , Mike Pagano , Randy Dunlap , Marek Vasut , Jimmy Su , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] media: i2c: add support for OV4689 Message-ID: References: <20221022162042.14113-1-mike.rudenko@gmail.com> <20221022162042.14113-3-mike.rudenko@gmail.com> <20221025130958.bnedjlkm6kmiluoe@uno.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221025130958.bnedjlkm6kmiluoe@uno.localdomain> X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 Jacopo, On Tue, Oct 25, 2022 at 03:09:58PM +0200, Jacopo Mondi wrote: > > +static int ov4689_configure_regulators(struct ov4689 *ov4689) > > +{ > > + unsigned int supplies_count = ARRAY_SIZE(ov4689_supply_names); No need for a temporary variable. > > + unsigned int i; > > + > > + for (i = 0; i < supplies_count; i++) > > + ov4689->supplies[i].supply = ov4689_supply_names[i]; > > + > > + return devm_regulator_bulk_get(&ov4689->client->dev, supplies_count, > > + ov4689->supplies); > > +} > > + > > +static u64 ov4689_check_link_frequency(struct v4l2_fwnode_endpoint *ep) > > +{ > > + unsigned int freqs_count = ARRAY_SIZE(link_freq_menu_items); > > + const u64 *freqs = link_freq_menu_items; > > + unsigned int i, j; > > + > > + for (i = 0; i < freqs_count; i++) { Ditto. > > + for (j = 0; j < ep->nr_of_link_frequencies; j++) > > + if (freqs[i] == ep->link_frequencies[j]) > > + return freqs[i]; > > + } > > + > > + return 0; > > +} > > + > > +static int ov4689_check_hwcfg(struct device *dev) > > +{ > > + struct fwnode_handle *fwnode = dev_fwnode(dev); > > + struct v4l2_fwnode_endpoint bus_cfg = { > > + .bus_type = V4L2_MBUS_CSI2_DPHY, > > + }; > > + struct fwnode_handle *endpoint; > > + int ret; > > + > > + endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL); > > + if (!endpoint) > > + return -EINVAL; > > + > > + ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &bus_cfg); > > + fwnode_handle_put(endpoint); > > + if (ret) > > + return ret; > > + > > + if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV4689_LANES) { > > + dev_err(dev, "Only a 4-lane CSI2 config is supported"); > > + ret = -EINVAL; > > + goto out_free_bus_cfg; > > + } > > + > > + if (!bus_cfg.nr_of_link_frequencies) { > > + dev_err(dev, "No link frequencies defined\n"); > > + ret = -EINVAL; > > + goto out_free_bus_cfg; > > + } > > As the driver has a single supported freq I wonder if it is required > to have it mandatory. I got contradictory feedbacks in the past, so > whatever you have here I guess it's fine (same reasoning goes for dts, > if there's only one accepted item, does it need to be made mandatory > ?) This check could indeed be removed, the one below already handles the case. The driver can be amended in the future to support additional frequencies. It probably requires more code here, too... I've got this in my tree, feel free to send a follow-up patch. > > Nits apart, the driver looks sane > > Reviewed-by: Jacopo Mondi Thanks! -- Regards, Sakari Ailus