public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	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
Date: Sat, 8 Jul 2023 17:21:16 +0100	[thread overview]
Message-ID: <20230708172116.42220c23@jic23-huawei> (raw)
In-Reply-To: <f6e2c7dae4de9978c53c46d9b2fade03033ce08e.1688723839.git.mazziesaccount@gmail.com>

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;
> +}
> +


  reply	other threads:[~2023-07-08 16:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 11:22 [PATCH v2 0/3] Support ROHM BU27010 RGBC sensor Matti Vaittinen
2023-07-07 11:22 ` [PATCH v2 1/3] dt-bindings: iio: ROHM BU27010 RGBC + flickering sensor Matti Vaittinen
2023-07-10  9:05   ` Krzysztof Kozlowski
2023-07-07 11:23 ` [PATCH v2 2/3] iio: light: bu27008: add chip info Matti Vaittinen
2023-07-08 16:16   ` Jonathan Cameron
2023-07-07 11:23 ` [PATCH v2 3/3] iio: light: bd27008: Support BD27010 RGB Matti Vaittinen
2023-07-08 16:21   ` Jonathan Cameron [this message]
2023-07-08 16:06 ` [PATCH v2 0/3] Support ROHM BU27010 RGBC sensor Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230708172116.42220c23@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox