devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jonathan Cameron
	<jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
Cc: Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>,
	"linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: "Generic" MMIO ADC
Date: Fri, 30 Jun 2017 10:33:05 -0500	[thread overview]
Message-ID: <CAL_JsqJ4gD=sSW40qE_gbKDBG_NA6eng_sr26b-4AV5D0uXjkA@mail.gmail.com> (raw)
In-Reply-To: <20170630145319.20ec3696-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>

On Fri, Jun 30, 2017 at 8:53 AM, Jonathan Cameron
<jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org> wrote:
> On Fri, 30 Jun 2017 10:44:42 +0200
> Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org> wrote:
>
>> I'm writing an IIO driver for a custom IP, which is pretty simple:
>>
>> - Map the registers to memory and register IRQ routine
>> - To start acquisition, write a value to the config register
>> - On interrupt, read data register, push it into queue
>> - To stop, write another value to config.
>>
>> Would it be useful to provide this as a generic driver in Linux, so that you
>> can provide the config register and data register offsets and values in the
>> devicetree? That would make it work on a lot of similar project without
>> everyone coding the same thing.
>
> Hi Mike,
>
> I've brought in the devicetree bindings maintainers and list as well on this
> discussion because in many ways it's more about the strategy on bindings
> than the actual driver...  Also Linus Walleij for any experience handing
> the gpio-mmio driver which strikes me as fairly similar in aim.
>
> To the driver question, yes absolutely this would be a good thing to have.
> The majority of ADCs out there are irritatingly more complex than what
> you have.  Everyone seems to feel obliged to put in their own 'special
> sauce'.
>
> As for bindings, there are two options, either we
>
> 1) As you suggest push all differences between different parts into the
> bindings.  Note we'll still need a compatible list in the driver.
> So this is something like gpio-mmio.c
>
> 2) Do something similar to the irq generic_chip (CONFIG_GENERIC_IRQ)
> infrastructure and actually have very slim wrapper drivers around a
> library.   That allows those elements that are constrained by the
> hardware to not need specifying in device tree bindings.
>
>>
>> And a related question: Is there a driver that's close to this?
> I can't immediately think of one, but it's possible that one
> of the SoC ADC drivers is simple enough to describe this way.
>
> So Mark / Rob.  You guys have experience with how the bindings
> worked out for each approach.  Which do you prefer?
> Either approach is fine with me.

The latter case. Specific bindings can map to a generic driver or
evolve to a specific driver if the generic one becomes inadequate.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-06-30 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b60def9a-45dc-bf97-e059-abbe105648b2@topic.nl>
     [not found] ` <b60def9a-45dc-bf97-e059-abbe105648b2-Oq418RWZeHk@public.gmane.org>
2017-06-30 13:53   ` "Generic" MMIO ADC Jonathan Cameron
     [not found]     ` <20170630145319.20ec3696-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2017-06-30 13:59       ` Linus Walleij
2017-06-30 15:33       ` Rob Herring [this message]
2017-07-03 12:37       ` Mike Looijmans
     [not found]         ` <b9dc2313-53da-1566-c0e8-ac18599f59da-Oq418RWZeHk@public.gmane.org>
2017-07-06 18:22           ` Jonathan Cameron
2017-07-06 21:37           ` Linus Walleij
     [not found]             ` <CACRpkdaZ=qSbdVxgw4DH_tOeZb0pZBYhhJJOozFn2pn25F_Kag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-07  7:44               ` Jonathan Cameron
     [not found]                 ` <20170707154448.00006dec-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-09  4:11                   ` Linus Walleij

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='CAL_JsqJ4gD=sSW40qE_gbKDBG_NA6eng_sr26b-4AV5D0uXjkA@mail.gmail.com' \
    --to=robh+dt-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mike.looijmans-Oq418RWZeHk@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).