devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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

  parent reply	other threads:[~2015-08-03 23:10 UTC|newest]

Thread overview: 15+ 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 ` [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
     [not found]   ` <1438635410-3757-3-git-send-email-mporter-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2015-08-03 22:39     ` Matt Ranostay
     [not found]       ` <CAKzfze9EcW0=yRGq=JBim7P8kQ4q+UgOd00qm=zA6oLz+Ut4DQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-03 23:10         ` Matt Porter [this message]
2015-08-04  7:50     ` Daniel Baluta
2015-08-04 13:01       ` Matt Porter
2015-08-04  9:30     ` Paul Bolle
     [not found]       ` <1438680636.8734.45.camel-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
2015-08-04 13:18         ` Matt Porter
2015-08-03 20:56 ` [PATCH 3/3] MAINTAINERS: add max6675 driver Matt Porter
     [not found] ` <1438635410-3757-1-git-send-email-mporter-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2015-08-04 16:52   ` [PATCH 0/3] MAX6675 IIO temperature driver Jonathan Cameron
     [not found]     ` <897A4C3B-DF7E-4AEE-A117-00CCB510F4DD-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2015-08-04 17:34       ` Matt Porter
2015-08-05  8:33         ` Daniel Baluta
2015-08-05 11:43           ` Matt Porter
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-owpks81ov/fwk0htik3j/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).