public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Maxim MAX1241 driver
@ 2020-03-17 20:17 Alexandru Lazar
  2020-03-17 20:17 ` [PATCH 1/2] iio: adc: Add " Alexandru Lazar
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Alexandru Lazar @ 2020-03-17 20:17 UTC (permalink / raw)
  To: linux-iio
  Cc: jic23, knaack.h, lars, pmeerw, robh+dt, mark.rutland,
	Alexandru Lazar

Hello!

This patch series adds support for the Maxim MAX1241, a 12-bit,
single-channel, SPI-connected ADC. It's a pretty sturdy ADC that I've
used for some time now and I figured my driver may be useful to others
as well.

I originally thought I might get this under the max1027 driver but the
124x family is different enough that shoehorning it in there didn't seem
like a good idea. The 1241 has a single channel, no FIFO, uses a
different mechanism to signal conversion start and has a low-power
operation mode which it uses in a pretty different way. This is actually
closer to MAX111x, but those also have a pretty different signaling
convention.

Needless to say, though, if anyone who is more familiar with this
situation disagrees and wants to point me in the direction of the
appropriate driver, I'm happy to make the changes there instead of
providing a separate driver.

Also please note that I am somewhat unfamiliar with the idioms of the
IIO subsystem's tree. Jonathan Cameron was kind enough to give me a few
pointers but there are a few questions I didn't bother him with (so I'm
guess I'm gonna bother you instead now).

1. There are two ADCs in this family, MAX1240 and MAX1241. This driver
only supports the MAX1241. The scaffolding to get MAX1240 support is in
there, but I didn't have access to a MAX1240 and I didn't want to submit
untested code for review. Can we add MAX1240 support later, or should I
do it from the very beginning? Either way is fine by me (I'm just a
little concerned about how quickly I might *get* a MAX1240 these
days...)

2. Looking at other drivers, it seems to me that, on ADCs that require
an external reference, it's customary to make a voltage regulator a
required property in the DT bindings. Am I correct here?

3. checkpatch.pl warns me that the MAINTAINERS file might need
updating. I'm not sure what the appropriate thing to do is here -- I can
maintain this driver indefinitely (I am actively using it anways) but
it's a 200-line driver, does that warrant inclusion in MAINTAINERS?

My apologies if anything here is distinctly bad -- this isn't the first
time I'm writing kernel code but it's definitely the first time I'm
sending ay upstream. Any bugs are due to my own incompetence, everything
else is just temporary ignorance :-).

Thanks,
Alex

Alexandru Lazar (2):
  iio: adc: Add MAX1241 driver
  dt-bindings: iio: adc: Add MAX1241 device tree bindings in
    documentation

 .../bindings/iio/adc/maxim,max1241.yaml       |  60 +++++
 drivers/iio/adc/Kconfig                       |  12 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/max1241.c                     | 215 ++++++++++++++++++
 4 files changed, 288 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml
 create mode 100644 drivers/iio/adc/max1241.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH 0/2] Maxim MAX1241 driver, v2
@ 2020-03-18 20:28 Alexandru Lazar
  2020-03-18 20:28 ` [PATCH 1/2] iio: adc: Add MAX1241 driver Alexandru Lazar
  0 siblings, 1 reply; 17+ messages in thread
From: Alexandru Lazar @ 2020-03-18 20:28 UTC (permalink / raw)
  To: linux-iio
  Cc: jic23, knaack.h, lars, pmeerw, robh+dt, mark.rutland,
	Alexandru Lazar

Hello again,

Here's version 2 of a patch series which adds support for the Maxim
MAX1241, a 12-bit, single-channel, SPI-connected ADC. The previous
version is here:

https://lore.kernel.org/linux-iio/20200317201710.23180-1-alazar@startmail.com/

I've integrated pretty much all of the suggestions I got here, and fixed
the issues that you all pointed out (thanks again! Did I say thanks
lately? Thanks!!!). A short list of the changes is at the end of this
message. checkpatch.pl is happy, it just warns me about the MAINTAINERS
file, where I don't think an entry is necessary. dt_bindings_check is
happy, too.

The only suggestion that I haven't incorporated is adding max1240 to the
list of compatible devices. I've thought about it, but there are
timing-related differences between the two devices, so simply validating
what my machine sends wouldn't be definitive. I think it would be
disingenious to claim compatibility under these circumstances. I do plan
to get a 1240 asap, anyway, and with any luck my patch would just update
the compat string.

Now, here's what I changed:

* Removed useeless header includes

* Dropped needlessly verbose stuff in _read and _probe functions

* Dropped useless GPL notice

* Lowered log level of shdn pin status in probe function, now it's
  dev_dbg
  
* Added proper error checking for the GPIO shutdown pin

* remove now always returns zero (man, I've been wrong about this for
  *years* now...)
  
* Added regulator disable action, cleanup is now handled via devm

* Drop delay_usecs, use delay.value, delay.unit

* Drop config_of, of_match_ptr call

* Dropped IIO_BUFFER, IIO_TRIGGERED_BUFFER dependencies, set SPI_MASTER
  as dependency, fix indenting.
  
* DT binding: use correct id, add reg description (looks pretty
  standard), dropped spi-max-frequency, fixed dt_binding_check
  complaints (oops!)

Thanks!

Alex

Alexandru Lazar (2):
  iio: adc: Add MAX1241 driver
  dt-bindings: iio: adc: Add MAX1241 device tree bindings in
    documentation

 .../bindings/iio/adc/maxim,max1241.yaml       |  62 ++++++
 drivers/iio/adc/Kconfig                       |  10 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/max1241.c                     | 206 ++++++++++++++++++
 4 files changed, 279 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml
 create mode 100644 drivers/iio/adc/max1241.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-03-19  6:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-17 20:17 [PATCH 0/2] Maxim MAX1241 driver Alexandru Lazar
2020-03-17 20:17 ` [PATCH 1/2] iio: adc: Add " Alexandru Lazar
2020-03-17 20:33   ` Lars-Peter Clausen
2020-03-17 20:40     ` Lars-Peter Clausen
2020-03-17 21:28     ` Alexandru Lazar
2020-03-17 21:40       ` Lars-Peter Clausen
2020-03-17 21:03   ` Lars-Peter Clausen
2020-03-18  6:50   ` Ardelean, Alexandru
2020-03-18  9:14     ` Alexandru Lazar
2020-03-18  9:31     ` Lars-Peter Clausen
2020-03-18  9:54       ` Ardelean, Alexandru
2020-03-18 16:00     ` Rohit Sarkar
2020-03-17 20:17 ` [PATCH 2/2] dt-bindings: iio: adc: Add MAX1241 device tree bindings in documentation Alexandru Lazar
2020-03-18  7:00   ` Ardelean, Alexandru
2020-03-17 20:52 ` [PATCH 0/2] Maxim MAX1241 driver Lars-Peter Clausen
  -- strict thread matches above, loose matches on Subject: below --
2020-03-18 20:28 [PATCH 0/2] Maxim MAX1241 driver, v2 Alexandru Lazar
2020-03-18 20:28 ` [PATCH 1/2] iio: adc: Add MAX1241 driver Alexandru Lazar
2020-03-19  6:51   ` Ardelean, Alexandru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox