lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOMteFUsKhDy1yks@smile.fi.intel.com>
Date:   Mon, 21 Aug 2023 12:25:12 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Marcus Folkesson <marcus.folkesson@...il.com>
Cc:     Kent Gustavsson <kent@...oris.se>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Cosmin Tanislav <demonsingur@...il.com>,
        Arnd Bergmann <arnd@...db.de>,
        ChiYuan Huang <cy_huang@...htek.com>,
        Haibo Chen <haibo.chen@....com>,
        Ramona Bolboaca <ramona.bolboaca@...log.com>,
        Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
        ChiaEn Wu <chiaen_wu@...htek.com>,
        William Breathitt Gray <william.gray@...aro.org>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 6/6] iio: adc: mcp3911: add support for the whole
 MCP39xx family

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@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ