All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Matt Ranostay <mranostay@gmail.com>, linux-iio@vger.kernel.org
Cc: jic23@kernel.org, Matt Porter <mporter@konsulko.com>
Subject: Re: [PATCH v5] iio: temperature: add support for Maxim thermocouple chips
Date: Fri, 01 Jul 2016 12:55:06 +0200	[thread overview]
Message-ID: <57764C0A.20607@denx.de> (raw)
In-Reply-To: <1467341579-31471-1-git-send-email-mranostay@gmail.com>

On 07/01/2016 04:52 AM, Matt Ranostay wrote:
> Add initial driver support for MAX6675, and MAX31855 thermocouple chips.
> 
> Cc: Marek Vasut <marex@denx.de>
> Cc: Matt Porter <mporter@konsulko.com>
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
> ---
> 
> Changes from v1:
> * switch to iio_device_*_direct_mode wrappers
> * add const to structs
> * removed useless cast
> 
> Changes from v2:
> * mark buffer data invalid on disconnected thermocouple
> * add .address = 0 to be consistent
> * add missing scan_mask for the max31855 part
> 
> Changes from v3:
> * fixed several typos of max31855 part number
> 
> Changes from v4:
> * drop maxim_thermocouple_validate_buffer() due to peer review saying
>   this is an incorrect way to signal an invalid reading

[...]

> +const struct iio_chan_spec max31855_channels[] = {
> +	{	/* thermocouple temperature */
> +		.type = IIO_TEMP,
> +		.address = 2,
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> +		.scan_index = 0,
> +		.scan_type = {
> +			.sign = 's',
> +			.realbits = 14,
> +			.storagebits = 16,
> +			.shift = 2,
> +			.endianness = IIO_BE,
> +		},
> +	},
> +	{	/* cold junction temperature */
> +		.type = IIO_TEMP,
> +		.address = 0,
> +		.channel2 = IIO_MOD_TEMP_AMBIENT,
> +		.modified = 1,
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> +		.scan_index = 1,
> +		.scan_type = {
> +			.sign = 's',
> +			.realbits = 12,
> +			.storagebits = 16,
> +			.shift = 4,
> +			.endianness = IIO_BE,
> +		},
> +	},
> +	IIO_CHAN_SOFT_TIMESTAMP(2),
> +};
> +
> +static const unsigned long max31855_scan_masks[] = {0x3, 0};
> +
> +struct maxim_thermocouple_chip {
> +	const struct iio_chan_spec *channels;
> +	const unsigned long *scan_masks;
> +	int num_channels;

const u8 or u32 ?

> +	int read_size;

const u8

> +	/* bit-check for valid input */
> +	int status_bit;

const bool ?

You can save some slop in here, see also:
http://www.catb.org/esr/structure-packing/

> +};
> +
> +const struct maxim_thermocouple_chip maxim_thermocouple_chips[] = {
> +	[MAX6675] = {
> +			.channels = max6675_channels,
> +			.num_channels = ARRAY_SIZE(max6675_channels),
> +			.read_size = 2,
> +			.status_bit = BIT(2),
> +		},
> +	[MAX31855] = {
> +			.channels = max31855_channels,
> +			.num_channels = ARRAY_SIZE(max31855_channels),
> +			.read_size = 4,
> +			.scan_masks = max31855_scan_masks,
> +			.status_bit = BIT(16),
> +		},
> +};
[...]

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-07-01 10:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  2:52 [PATCH v5] iio: temperature: add support for Maxim thermocouple chips Matt Ranostay
2016-07-01 10:55 ` Marek Vasut [this message]
2016-07-04  5:37   ` Matt Ranostay
2016-07-05  1:21     ` Matt Ranostay

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=57764C0A.20607@denx.de \
    --to=marex@denx.de \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=mporter@konsulko.com \
    --cc=mranostay@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.