From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D905EB64DC for ; Sat, 8 Jul 2023 16:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229713AbjGHQV0 (ORCPT ); Sat, 8 Jul 2023 12:21:26 -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 Precedence: bulk List-ID: X-Mailing-List: devicetree@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; > +} > +