public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Marcus Folkesson <marcus.folkesson@gmail.com>
Cc: Kent Gustavsson <kent@minoris.se>,
	Jonathan Cameron <jic23@kernel.org>,
	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>,
	Cosmin Tanislav <demonsingur@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	ChiYuan Huang <cy_huang@richtek.com>,
	Haibo Chen <haibo.chen@nxp.com>,
	Ramona Bolboaca <ramona.bolboaca@analog.com>,
	Ibrahim Tilki <Ibrahim.Tilki@analog.com>,
	ChiaEn Wu <chiaen_wu@richtek.com>,
	William Breathitt Gray <william.gray@linaro.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 6/6] iio: adc: mcp3911: add support for the whole MCP39xx family
Date: Mon, 21 Aug 2023 12:25:12 +0300	[thread overview]
Message-ID: <ZOMteFUsKhDy1yks@smile.fi.intel.com> (raw)
In-Reply-To: <20230820102610.755188-7-marcus.folkesson@gmail.com>

On Sun, Aug 20, 2023 at 12:26:10PM +0200, Marcus Folkesson wrote:
> Microchip does have many similar chips, add support for those.
> 
> The new supported chips are:
>   - microchip,mcp3910
>   - microchip,mcp3912
>   - microchip,mcp3913
>   - microchip,mcp3914
>   - microchip,mcp3918
>   - microchip,mcp3919

A few really minor things, after addressing them
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you for this journey!

...

> +static int mcp3910_enable_offset(struct mcp3911 *adc, bool enable)
> +{
> +	unsigned int mask = MCP3910_CONFIG0_EN_OFFCAL;

	unsigned int value = enable ? mask : 0;

> +
> +	if (enable)
> +		return mcp3911_update(adc, MCP3910_REG_CONFIG0, mask, mask, 3);
> +	else
> +		return mcp3911_update(adc, MCP3910_REG_CONFIG0, mask, 0, 3);

	return mcp3911_update(adc, MCP3910_REG_CONFIG0, mask, value, 3);

> +}

...

> +static int mcp3911_enable_offset(struct mcp3911 *adc, bool enable)
> +{
> +	unsigned int mask = MCP3911_STATUSCOM_EN_OFFCAL;
> +
> +	if (enable)
> +		return mcp3911_update(adc, MCP3911_REG_STATUSCOM, mask, mask, 2);
> +	else
> +		return mcp3911_update(adc, MCP3911_REG_STATUSCOM, mask, 0, 2);
> +}

Ditto.

...

> +static int mcp3910_get_osr(struct mcp3911 *adc, u32 *val)
> +{
> +	int ret, osr;

	unsigned int osr;

> +
> +	ret = mcp3911_read(adc, MCP3910_REG_CONFIG0, val, 3);
> +	if (ret)
> +		return ret;
> +
> +	osr = FIELD_GET(MCP3910_CONFIG0_OSR, *val);
> +	*val = 32 << osr;
> +	return 0;
> +}

...

> +static int mcp3910_set_osr(struct mcp3911 *adc, u32 val)
> +{
> +	int osr = FIELD_PREP(MCP3910_CONFIG0_OSR, val);

Ditto.

> +	unsigned int mask = MCP3910_CONFIG0_OSR;
> +
> +	return mcp3911_update(adc, MCP3910_REG_CONFIG0, mask, osr, 3);
> +}

...

> +static int mcp3911_set_osr(struct mcp3911 *adc, u32 val)
> +{
> +	int osr = FIELD_PREP(MCP3911_CONFIG_OSR, val);

Ditto.

> +	unsigned int mask = MCP3911_CONFIG_OSR;
> +
> +	return mcp3911_update(adc, MCP3911_REG_CONFIG, mask, osr, 2);
> +}
> +
> +static int mcp3911_get_osr(struct mcp3911 *adc, u32 *val)
> +{
> +	int ret, osr;
> +
> +	ret = mcp3911_read(adc, MCP3911_REG_CONFIG, val, 2);
> +	if (ret)
> +		return ret;
> +
> +	osr = FIELD_GET(MCP3911_CONFIG_OSR, *val);
> +	*val = 32 << osr;
> +	return ret;
> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-08-21  9:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-20 10:26 [PATCH v7 0/6] Add support for the whole MCP39xx family Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 1/6] dt-bindings: iio: adc: mcp3911: add " Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 2/6] iio: adc: mcp3911: make use of dev_err_probe() Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 3/6] iio: adc: mcp3911: simplify usage of spi->dev Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 4/6] iio: adc: mcp3911: fix indentation Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 5/6] iio: adc: mcp3911: avoid ambiguity parameters in macros Marcus Folkesson
2023-08-20 10:26 ` [PATCH v7 6/6] iio: adc: mcp3911: add support for the whole MCP39xx family Marcus Folkesson
2023-08-21  9:25   ` Andy Shevchenko [this message]
2023-08-22 19:53     ` Marcus Folkesson

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=ZOMteFUsKhDy1yks@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Ibrahim.Tilki@analog.com \
    --cc=arnd@arndb.de \
    --cc=chiaen_wu@richtek.com \
    --cc=conor+dt@kernel.org \
    --cc=cy_huang@richtek.com \
    --cc=demonsingur@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=haibo.chen@nxp.com \
    --cc=jic23@kernel.org \
    --cc=kent@minoris.se \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.folkesson@gmail.com \
    --cc=ramona.bolboaca@analog.com \
    --cc=robh+dt@kernel.org \
    --cc=william.gray@linaro.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