Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp33367588rwd; Sat, 8 Jul 2023 10:12:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcxcQzJov7XFDYMgsjcO53hI8nysf6wq1Ac87TAA7uNzQA44734fMxPHGo5Q1QG2xOHcCb X-Received: by 2002:a05:6a20:9384:b0:130:3c8b:4204 with SMTP id x4-20020a056a20938400b001303c8b4204mr9004808pzh.8.1688836332632; Sat, 08 Jul 2023 10:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688836332; cv=none; d=google.com; s=arc-20160816; b=s1+VWbhQmJcnqSWnNMXNf0UIRfmnvpfEadgOMHnte2YGuR95EV8Fj4O4a0DvJkEH1G 7uniQSkQ+HcG/Pt5e0M7b2YXzFF/UmwGhPdLPujcZ8PFOj5R/Y26T6PTrdCE7KzOXtN5 Kxv1FByM/ZPWBbyoXx1/kg6N4rRYSiBBoUyiUsLuk51zl525Nqx1xsqhP3pTTg46Lisr 5JydSOV/2NND9S0j3iJ+vE1CqQcUtovNpc9ndPn7HKliZI3gbasGplq5KOi0AJ2Ahcv3 P+OlqN2ar64WwjVNcSR6hWSIh862j6jY+cr3/fs78eCKkdS/QZBRuFnCVYAYYd7YugFy ksAg== 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=6k3T+WGoPJg5BM+n/YJM+u57P+WaAmHJHeTijjYYU6k=; fh=6A/yyIjJm4kp5YlbsOunyTQi+bLFloivqrjLm2ZCMvc=; b=NP4hpFv1VFdcBvK5bZFShVgXCxQ/d1Uq4gog9rQISahJqCIdYdro2dFOyyRxJaq7Pt n73CNFZXyzhUo+JYU1om7eKoR9jyKqgd0ibJrXDHNWdrvX7Mbcc/nwnqR9AjtxyQyi0r G42fPGc5OClmHkRPEpv7GuVhcvW6NUOfQwpaM0v9kUJ+e1UaNfWyk5q6TE4ynnupowZ4 6qprLNyynX+C+HFl2dph8DOCkQyp/uokSauvxjwaG5sSHRHRma/7Ruh8W3/6sO1e6x7f NfaKBoKGYDpDyjJmW2GhjTKY2NZDTeuX5AfXdPyMVxy457piERAABaW95kiAXgufJqvK 3k+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ew2f/I6+"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a631607000000b005401008809bsi5672259pgl.752.2023.07.08.10.11.51; Sat, 08 Jul 2023 10:12:12 -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=@kernel.org header.s=k20201202 header.b="Ew2f/I6+"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbjGHQV1 (ORCPT + 99 others); Sat, 8 Jul 2023 12:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjGHQV0 (ORCPT ); Sat, 8 Jul 2023 12:21:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748051BD; Sat, 8 Jul 2023 09:21:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 090D460BBB; Sat, 8 Jul 2023 16:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62ECFC433C7; Sat, 8 Jul 2023 16:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688833284; bh=REI8mm0g3Ln4d1mUrUIddDRs8mEfYtqHZnt5LA4GD2g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ew2f/I6+MIkf55capRaAfx52XTSQNvXPRfj8ddTasB9avsaHAqOqN9l8A4wpsRWQ5 WKoGyzne+ggKIO7J6Kkm+wAKAfphdJUX9WKy+VQLGOKTMnSI0NsgQTPAXfQMnG6GJx A8sj9Bmv408Hvk3DRdMKHHY22dWo/RIehyNBNfvZ6uCEenVunTQqHOnJ3EK+f21fVQ dwp7K8TNrAK5UuElf0Q4y5Ys0uXGwObZlBvKqXTSnRTYG0wpFH/mWuDNkBgHF3vFmm 3QehyzixKaupBimpo1/rFOo8YhP0oCDrEW+axOKWmlt/NUahN6FnMw3CB/QUbqSDnN MGO3MvxGZAKOw== Date: Sat, 8 Jul 2023 17:21:16 +0100 From: Jonathan Cameron To: Matti Vaittinen Cc: Matti Vaittinen , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] iio: light: bd27008: Support BD27010 RGB Message-ID: <20230708172116.42220c23@jic23-huawei> In-Reply-To: References: 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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 One trivial request for a comment. Otherwise (subject to jetlag - which snuck up on me during this review) this looks fine to me.. Will be a few weeks though until the precursor series does the round trip via upstream to get into the branch I'd want to apply this on. Jonathan > > +static int bu27010_get_gain_sel(struct bu27008_data *data, int *sel) > +{ > + int ret, tmp; > + > + /* > + * We always "lock" the gain selectors for all channels to prevent > + * unsupported configs. It does not matter which channel is used > + * we can just return selector from any of them. > + */ > + ret = regmap_read(data->regmap, BU27008_REG_MODE_CONTROL2, sel); > + if (ret) > + return ret; > + > + *sel = FIELD_GET(BU27010_MASK_DATA0_GAIN, *sel); > + > + ret = regmap_read(data->regmap, BU27008_REG_MODE_CONTROL1, &tmp); > + if (ret) > + return ret; > + > + *sel |= FIELD_GET(BU27010_MASK_RGBC_GAIN, tmp) << fls(BU27010_MASK_DATA0_GAIN); Odd enough to perhaps warrant a comment on the maths. > + > + return ret; > +} > +