Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1971143rdh; Sat, 25 Nov 2023 08:47:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2oY5QHTZZ8YwxcsigvHKMtQ5710f3FHRyNq/8+hYtakZuSuqlTHOCdsVpPevWWJHONGli X-Received: by 2002:a17:90b:3143:b0:285:ad29:40b8 with SMTP id ip3-20020a17090b314300b00285ad2940b8mr1490374pjb.9.1700930823259; Sat, 25 Nov 2023 08:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700930823; cv=none; d=google.com; s=arc-20160816; b=F47kub4fn9yOCIFKgo1Ul845bYGkMVu9yh9r3GoafkOXJDeGL3RbSAGl9pppw7PRPP 5PS8nuHPmWc94gW1Q3I7QH7c5uKVE2sKHXxJZp7X4PvrQnkHdqji6YtOycENvcuYQARp oXJId9yTveVNqRwymusSUJm0/FNbBkEUns/HuCqULI/OMA0T7QrIIjiVYgspJ4KDaj1I RqYYa3sbD3qPI8MAKIo2kTOgFY03bt74hgG1Ul/nTLGT505gZoQAdZICvZnAg2EKi9Qs xGpvZ0+SjBsk7dDxPnpQlOJQ3TzGY3HJtViP5ZGjUSbkOt0ZeJAjsbVBAGayI1eWg4uX 6lZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=6wjgr17AYMwvX3VDNj/E7YoXYjgFl0d2hUQdFa0SgUg=; fh=WFctVS/hjsRT9aDevEulWP2rqJ2dsHRqYny57R4XUhk=; b=g10hbGB18U4DEZF3qNAX3jwXkVDdx3pQU/qMDoPqE6rJllgWrvwvA68F9ul11Xi3Gx AIClN7H/hlIKSWEV4CcaeL/3S1I6bnD9rQM/uqghV7WxRb9CLDpzUA/d2RSzpnJlWFhu RbqXfVwt4OUYlCJ0NqB1AIbRripUhtY8FA6Vkz4AVIps6h/ktAirvgwoRsdoxI6B/V00 lxhP7TnW59UdJefIGndzPwJKmd+tLgetgXvUmwzhmvXu5II4QqL+Vwijh/J9mqXmO7Fs AzXWpCjtvt6NEelHrnPHd+N6zlkPjET2Z2mXqOrsXlJMrpK0TEq3oYnKB4MJlFOwGe6r ZU0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PG5WG1ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a9-20020a17090a740900b0027d2db562d2si6019088pjg.161.2023.11.25.08.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 08:47:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PG5WG1ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C051A807755C; Sat, 25 Nov 2023 08:45:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbjKYQph (ORCPT + 99 others); Sat, 25 Nov 2023 11:45:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbjKYQpf (ORCPT ); Sat, 25 Nov 2023 11:45:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE67106 for ; Sat, 25 Nov 2023 08:45:41 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D65C433C7; Sat, 25 Nov 2023 16:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700930741; bh=kC67tlW47eQO8hIkRqPMLcnEKgkghYrvxLkHQPnjYIg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PG5WG1cil8UVXUZ+TJ6SDZt0pEnC8sBNnLwATz+ip+qJd0BYmRHf9mourflb6J2RG rgYDKodTH+9brjJQE6wjDkvHBDF5lQ3Wl/jocRE77W4YriCE5aHFYpTFfav4n2ljiN QxbAIZ8jIi00mapBRw/I/rt2pf+HCkhQQ3cyUJS0yOFaKuIKF50JKAQJysq7/6sxyn /NTAFTxqkZ7o4LlfZvvf14l2sK4MPbp9YArbCoYWMGIUmW6zHOjeu6xeLKF18ucVkD vmJ0gKCDxazeaYdWWQAwyeUTZ8cKGWr0D/t5p7B3CO3tidA4wL0szbFRCiC+OasbE0 65adPTDu9VAtg== Date: Sat, 25 Nov 2023 16:45:33 +0000 From: Jonathan Cameron To: Javier Carrasco Cc: Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 3/3] iio: light: add VEML6075 UVA and UVB light sensor driver Message-ID: <20231125164533.57abf756@jic23-huawei> In-Reply-To: <659d5d74-4861-45c4-8b95-218f3a7e60cf@gmail.com> References: <20231110-veml6075-v2-0-d04efbc8bf51@gmail.com> <20231110-veml6075-v2-3-d04efbc8bf51@gmail.com> <20231125151116.6d9b6e46@jic23-huawei> <659d5d74-4861-45c4-8b95-218f3a7e60cf@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 25 Nov 2023 08:45:52 -0800 (PST) On Sat, 25 Nov 2023 17:17:06 +0100 Javier Carrasco wrote: > On 25.11.23 16:11, Jonathan Cameron wrote: > > On Sat, 25 Nov 2023 12:56:57 +0100 > > Javier Carrasco wrote: > > > >> The Vishay VEMl6075 is a low power, 16-bit resolution UVA and UVB > >> light sensor with I2C interface and noise compensation (visible and > >> infrarred). > >> > >> Every UV channel generates an output signal measured in counts per > >> integration period, where the integration time is configurable. > >> > >> This driver adds support for both UV channels and the ultraviolet > >> index (UVI) inferred from them according to the device application note > >> with open-air (no teflon) coefficients. > >> > >> Signed-off-by: Javier Carrasco > > > > Hi Javier, > > > > A few more minor things. Looks good in general. > > > > Jonathan > > > >> +struct veml6075_data { > >> + struct i2c_client *client; > >> + struct regmap *regmap; > >> + struct mutex lock; /* integration time/measurement trigger lock */ > > > > Could perhaps be clearer. Maybe something like > > /* Prevent integration time changing during a measurement */ > > > It prevents integration time changing as well as measurement triggers > while a measurement is underway. I just wanted to cover both usages with > a short comment in the same line. Ah. Well I misunderstood it, so burn a few more lines :) > >> + > >> +static int veml6075_uva_comp(int raw_uva, int comp1, int comp2) > >> +{ > >> + int comp1a_c, comp2a_c, uva_comp; > >> + > >> + comp1a_c = (comp1 * VEML6075_A_COEF) / 1000U; > >> + comp2a_c = (comp2 * VEML6075_B_COEF) / 1000U; > >> + uva_comp = raw_uva - comp1a_c - comp2a_c; > >> + > >> + return clamp_val(uva_comp, 0, U16_MAX); > >> +} > >> + > >> +static int veml6075_uvb_comp(int raw_uvb, int comp1, int comp2) > >> +{ > >> + int comp1b_c, comp2b_c, uvb_comp; > >> + > >> + comp1b_c = (comp1 * VEML6075_C_COEF) / 1000U; > > > > Any of units.h appropriate here? I'm not sure if the / 1000U is a units > > thing or not. > > > These divisions are used to scale the coefficients down, as they are > defined as entire numbers. These coefficients have no units and the > resulting value is a count. Fair enough. > > I have nothing to add to the rest of your comments. I will start working > on v3. > > Thanks again for your thorough review. > > Best regards, > Javier Carrasco