From: Matt Porter <mporter@konsulko.com>
To: Matt Ranostay <mranostay@gmail.com>
Cc: Linux IIO List <linux-iio@vger.kernel.org>,
Devicetree List <devicetree@vger.kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver
Date: Mon, 3 Aug 2015 19:10:19 -0400 [thread overview]
Message-ID: <20150803231019.GJ15004@beef> (raw)
In-Reply-To: <CAKzfze9EcW0=yRGq=JBim7P8kQ4q+UgOd00qm=zA6oLz+Ut4DQ@mail.gmail.com>
On Mon, Aug 03, 2015 at 03:39:00PM -0700, Matt Ranostay Matt Ranostay wrote:
> On Mon, Aug 3, 2015 at 1:56 PM, Matt Porter <mporter@konsulko.com> wrote:
...
> > +static int max6675_probe(struct spi_device *spi)
> > +{
> > + struct iio_dev *indio_dev;
> > + struct max6675_state *st;
> > + int ret = 0;
> > +
> > + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + st = iio_priv(indio_dev);
> > + st->spi = spi;
> > +
> > + spi->mode = SPI_MODE_1;
> > + spi->bits_per_word = 16;
>
> Have this error or display a warning when it doesn't match the passed
> DT binding settings. Otherwise it may get confusing why other SPI
> modes and word sizes don't work.
Ok, good point. The only thing here is that I've specified that spi-cpha
is required in the binding, indicating that Mode 1 will be used. I need
this driver to be instantiated via three methods: ACPI, DT, and "board
file" so for the latter I'm hardcoding in the driver the mode. The
device only works in Mode 1 so this seems sane, it's not configurable.
I don't parse that mode from either DT or ACPI data since it's not
needed. About the only thing I could do is pedantically check for
spi-cpha and if not present complain..but I think it's fine to simply
not parse at all given that we've hardcoded this for the allowed mode.
There's no property for bits_per_word, it's configured on a per-transfer
basis. In this case, this configures the default to do a 16-bit transfer
as required by the device. There is no way to modify this by a client of
this driver.
-Matt
WARNING: multiple messages have this Message-ID (diff)
From: Matt Porter <mporter-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
To: Matt Ranostay <mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Linux IIO List
<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Devicetree List
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver
Date: Mon, 3 Aug 2015 19:10:19 -0400 [thread overview]
Message-ID: <20150803231019.GJ15004@beef> (raw)
In-Reply-To: <CAKzfze9EcW0=yRGq=JBim7P8kQ4q+UgOd00qm=zA6oLz+Ut4DQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Mon, Aug 03, 2015 at 03:39:00PM -0700, Matt Ranostay Matt Ranostay wrote:
> On Mon, Aug 3, 2015 at 1:56 PM, Matt Porter <mporter-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote:
...
> > +static int max6675_probe(struct spi_device *spi)
> > +{
> > + struct iio_dev *indio_dev;
> > + struct max6675_state *st;
> > + int ret = 0;
> > +
> > + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + st = iio_priv(indio_dev);
> > + st->spi = spi;
> > +
> > + spi->mode = SPI_MODE_1;
> > + spi->bits_per_word = 16;
>
> Have this error or display a warning when it doesn't match the passed
> DT binding settings. Otherwise it may get confusing why other SPI
> modes and word sizes don't work.
Ok, good point. The only thing here is that I've specified that spi-cpha
is required in the binding, indicating that Mode 1 will be used. I need
this driver to be instantiated via three methods: ACPI, DT, and "board
file" so for the latter I'm hardcoding in the driver the mode. The
device only works in Mode 1 so this seems sane, it's not configurable.
I don't parse that mode from either DT or ACPI data since it's not
needed. About the only thing I could do is pedantically check for
spi-cpha and if not present complain..but I think it's fine to simply
not parse at all given that we've hardcoded this for the allowed mode.
There's no property for bits_per_word, it's configured on a per-transfer
basis. In this case, this configures the default to do a 16-bit transfer
as required by the device. There is no way to modify this by a client of
this driver.
-Matt
next prev parent reply other threads:[~2015-08-03 23:10 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 20:56 [PATCH 0/3] MAX6675 IIO temperature driver Matt Porter
2015-08-03 20:56 ` Matt Porter
2015-08-03 20:56 ` [PATCH 1/3] iio: temperature: add max6675 dt binding Matt Porter
2015-08-03 20:56 ` [PATCH 2/3] iio: temperature: add max6675 thermocouple converter driver Matt Porter
2015-08-03 21:26 ` Peter Meerwald
2015-08-03 23:13 ` Matt Porter
2015-08-06 17:38 ` Matt Porter
2015-08-08 11:39 ` Jonathan Cameron
2015-08-20 0:23 ` Matt Porter
2015-08-23 15:44 ` Jonathan Cameron
2015-08-03 22:39 ` Matt Ranostay
2015-08-03 22:39 ` Matt Ranostay
2015-08-03 23:10 ` Matt Porter [this message]
2015-08-03 23:10 ` Matt Porter
2015-08-04 7:50 ` Daniel Baluta
2015-08-04 7:50 ` Daniel Baluta
2015-08-04 13:01 ` Matt Porter
2015-08-04 9:30 ` Paul Bolle
2015-08-04 9:30 ` Paul Bolle
2015-08-04 13:18 ` Matt Porter
2015-08-04 13:18 ` Matt Porter
2015-08-03 20:56 ` [PATCH 3/3] MAINTAINERS: add max6675 driver Matt Porter
2015-08-04 16:52 ` [PATCH 0/3] MAX6675 IIO temperature driver Jonathan Cameron
2015-08-04 16:52 ` Jonathan Cameron
2015-08-04 17:34 ` Matt Porter
2015-08-04 17:34 ` Matt Porter
2015-08-05 8:33 ` Daniel Baluta
2015-08-05 8:33 ` Daniel Baluta
2015-08-05 11:43 ` Matt Porter
2015-08-08 11:36 ` Jonathan Cameron
2015-08-08 11:36 ` 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=20150803231019.GJ15004@beef \
--to=mporter@konsulko.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mranostay@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 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.