Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1201934 > unrolled thread

Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver

Started byMatt Porter <mporter@konsulko.com>
First post2015-08-06 19:40 +0200
Last post2015-08-08 13:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter  driver Matt Porter <mporter@konsulko.com> - 2015-08-06 19:40 +0200
    Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter  driver Jonathan Cameron <jic23@kernel.org> - 2015-08-08 13:40 +0200

#1201934 — Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver

FromMatt Porter <mporter@konsulko.com>
Date2015-08-06 19:40 +0200
SubjectRe: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver
Message-ID<pUxj8-7uZ-59@gated-at.bofh.it>
On Mon, Aug 03, 2015 at 11:26:12PM +0200, Peter Meerwald wrote:
> On Mon, 3 Aug 2015, Matt Porter wrote:

...

> > +static int max6675_read(struct max6675_state *st, int *val)
> > +{
> > +	int ret;
> > +
> > +	ret = spi_read(st->spi, val, 2);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	/* Temperature is bits 14..3 */
> > +	*val = (*val >> 3) & 0xfff;
> 
> what about endianness conversion?
> use be16_to_cpu()

Apologies, I spoke before engaging the brain on my first reply to this
As specified by the SPI subsystem docs, SPI buffers are always stored
in native endian order. There is no need for endianness conversion here.

-Matt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1203252

FromJonathan Cameron <jic23@kernel.org>
Date2015-08-08 13:40 +0200
Message-ID<pVaDM-5Uh-27@gated-at.bofh.it>
In reply to#1201934
On 06/08/15 18:38, Matt Porter wrote:
> On Mon, Aug 03, 2015 at 11:26:12PM +0200, Peter Meerwald wrote:
>> On Mon, 3 Aug 2015, Matt Porter wrote:
> 
> ...
> 
>>> +static int max6675_read(struct max6675_state *st, int *val)
>>> +{
>>> +	int ret;
>>> +
>>> +	ret = spi_read(st->spi, val, 2);
>>> +	if (ret < 0)
>>> +		return ret;
>>> +
>>> +	/* Temperature is bits 14..3 */
>>> +	*val = (*val >> 3) & 0xfff;
>>
>> what about endianness conversion?
>> use be16_to_cpu()
> 
> Apologies, I spoke before engaging the brain on my first reply to this
> As specified by the SPI subsystem docs, SPI buffers are always stored
> in native endian order. There is no need for endianness conversion here.
First of all, which doc say this?
Secondly how does SPI know the endianness of the sensor which is what
actually matters here?  I2C can in theory make these guarantees as there
is an expected byte order on the wire (even if quite a few drivers don't
conform to the spec anyway). No such guarantee can exist for SPI.

Jonathan


> 
> -Matt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web