Skip to contentSkip to conversation

hwmon: (max127) Add Maxim MAX127 hardware monitoring

PATCH Superseded [email protected] 7 participants 15 messages Nov 18, 2020 – Nov 19, 2020

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: (max127) Add Maxim MAX127 hardware monitoring

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Patch #1 adds the max127 hardware monitoring driver, and patch #2 adds documentation for the driver.

Tao Ren (2):
hwmon: (max127) Add Maxim MAX127 hardware monitoring driver
docs: hwmon: Document max127 driver

 Documentation/hwmon/index.rst  |   1 +
 Documentation/hwmon/max127.rst |  45 +++++
 drivers/hwmon/Kconfig          |   9 +
 drivers/hwmon/Makefile         |   1 +
 drivers/hwmon/max127.c         | 346 +++++++++++++++++++++++++++++++++
 5 files changed, 402 insertions(+)
 create mode 100644 Documentation/hwmon/max127.rst
 create mode 100644 drivers/hwmon/max127.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 hwmon: (max127) Add Maxim MAX127 hardware monitoring driver

From: Tao Ren <[email protected]>

Add hardware monitoring driver for the Maxim MAX127 chip.

MAX127 min/max range handling code is inspired by the max197 driver.

---
Changes in v2:
- replace devm_hwmon_device_register_with_groups() with devm_hwmon_device_register_with_info() API.
- divide min/max read and write methods to separate functions.
- fix raw-to-vin conversion logic.
- refine ctrl_byte handling so mutex is not needed to protect the byte.
- improve i2c_transfer() error handling.
- a few other improvements (comments, variable naming, and etc.).

 drivers/hwmon/Kconfig  |   9 ++
 drivers/hwmon/Makefile |   1 +
 drivers/hwmon/max127.c | 346 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 356 insertions(+)
 create mode 100644 drivers/hwmon/max127.c
drivers/hwmon/Kconfig +9 -0
index 9d600e0c5584..716df51edc87 100644
@@ -950,6 +950,15 @@ config SENSORS_MAX1111
 	  This driver can also be built as a module. If so, the module
 	  will be called max1111.
 
+config SENSORS_MAX127
+	tristate "Maxim MAX127 12-bit 8-channel Data Acquisition System"
+	depends on I2C
+	help
+	  Say y here to support Maxim's MAX127 DAS chips.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called max127.
+
 config SENSORS_MAX16065
 	tristate "Maxim MAX16065 System Manager and compatibles"
 	depends on I2C
drivers/hwmon/Makefile +1 -0
index 1083bbfac779..01ca5d3fbad4 100644
@@ -127,6 +127,7 @@ obj-$(CONFIG_SENSORS_LTC4260)	+= ltc4260.o
 obj-$(CONFIG_SENSORS_LTC4261)	+= ltc4261.o
 obj-$(CONFIG_SENSORS_LTQ_CPUTEMP) += ltq-cputemp.o
 obj-$(CONFIG_SENSORS_MAX1111)	+= max1111.o
+obj-$(CONFIG_SENSORS_MAX127)	+= max127.o
 obj-$(CONFIG_SENSORS_MAX16065)	+= max16065.o
 obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
 obj-$(CONFIG_SENSORS_MAX1668)	+= max1668.o
drivers/hwmon/max127.c new file +346 -0

346 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 docs: hwmon: Document max127 driver

In reply to [email protected]

From: Tao Ren <[email protected]>

Add documentation for the max127 hardware monitoring driver.

---
Changes in v2:
- add more description for min/max sysfs nodes.
- convert values from volt to millivolt in the document.

 Documentation/hwmon/index.rst  |  1 +
 Documentation/hwmon/max127.rst | 45 ++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 Documentation/hwmon/max127.rst
Documentation/hwmon/index.rst +1 -0
index 408760d13813..0a07b6000c20 100644
@@ -111,6 +111,7 @@ Hardware Monitoring Kernel Drivers
    ltc4245
    ltc4260
    ltc4261
+   max127
    max16064
    max16065
    max1619
Documentation/hwmon/max127.rst new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#4 lore raw
Quoted 11 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Cheers,

Tao

maintainer
#5 lore raw
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

Guenter

maintainer
#6 lore raw
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Quoted 7 lines

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

I found it. The XDP maintainer entry has:

K: xdp

This matches Documentation/hwmon/index.rst.

$ grep xdp Documentation/hwmon/index.rst
   xdpe12284

It seems to me that a context match such as "xdp" in MAINTAINERS isn't really appropriate. "xdp" matches a total of 348 files in the kernel. The large majority of those is not XDP related. The maintainers of XDP (and all the listed mailing lists) should not be surprised to get a large number of odd review requests if they want to review every single patch on files which include the term "xdp".

Guenter

author
#7 lore raw
Quoted 38 lines · Guenter Roeck
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Quoted 7 lines

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

I found it. The XDP maintainer entry has:

K: xdp

This matches Documentation/hwmon/index.rst.

$ grep xdp Documentation/hwmon/index.rst
   xdpe12284
Quoted 8 lines

It seems to me that a context match such as "xdp" in MAINTAINERS isn't really appropriate. "xdp" matches a total of 348 files in the kernel. The large majority of those is not XDP related. The maintainers of XDP (and all the listed mailing lists) should not be surprised to get a large number of odd review requests if they want to review every single patch on files which include the term "xdp".

Guenter

Thanks Guenter and Andrew. Given xdp maintainers were included by mistake, I will remove them from the future discussions of this hwmon patch series.

Cheers,

Tao

maintainer
#8 lore raw
In reply to Guenter Roeck
Quoted 37 lines · On Wed, 18 Nov 2020 17:26:53 -0800 Guenter Roeck wrote:
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Quoted 6 lines

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

I found it. The XDP maintainer entry has:

K: xdp

This matches Documentation/hwmon/index.rst.

$ grep xdp Documentation/hwmon/index.rst
   xdpe12284
Quoted 6 lines

It seems to me that a context match such as "xdp" in MAINTAINERS isn't really appropriate. "xdp" matches a total of 348 files in the kernel. The large majority of those is not XDP related. The maintainers of XDP (and all the listed mailing lists) should not be surprised to get a large number of odd review requests if they want to review every single patch on files which include the term "xdp".

Agreed, we should fix this. For maintainers with high patch volume life would be so much easier if people CCed the right folks to get reviews, so we should try our best to fix get_maintainer.

XDP folks, any opposition to changing the keyword / filename to:

	[^a-z0-9]xdp[^a-z0-9]

?

#9 lore raw

XDP maintainer match (Was [PATCH v2 0/2] hwmon: (max127) Add Maxim MAX127 hardware monitoring)

Quoted 49 lines · On Thu, 19 Nov 2020 07:46:34 -0800 Jakub Kicinski <[email protected]> wrote:
Quoted 37 lines · On Wed, 18 Nov 2020 17:26:53 -0800 Guenter Roeck wrote:
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Quoted 6 lines

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

I found it. The XDP maintainer entry has:

K: xdp

This matches Documentation/hwmon/index.rst.

$ grep xdp Documentation/hwmon/index.rst
   xdpe12284
Quoted 6 lines

It seems to me that a context match such as "xdp" in MAINTAINERS isn't really appropriate. "xdp" matches a total of 348 files in the kernel. The large majority of those is not XDP related. The maintainers of XDP (and all the listed mailing lists) should not be surprised to get a large number of odd review requests if they want to review every single patch on files which include the term "xdp".

Agreed, we should fix this. For maintainers with high patch volume life would be so much easier if people CCed the right folks to get reviews, so we should try our best to fix get_maintainer.

Quoted 5 lines

XDP folks, any opposition to changing the keyword / filename to:

	[^a-z0-9]xdp[^a-z0-9]

?

I think it is a good idea to change the keyword (K:), but I'm not sure this catch what we want, maybe it does. The pattern match are meant to catch drivers containing XDP related bits.

Previously Joe Perches <[email protected]> suggested this pattern match, which I don't fully understand... could you explain Joe?

(?:\b|_)xdp(?:\b|_)

For the filename (N:) regex match, I'm considering if we should remove it and list more files explicitly. I think normal glob * pattern works, which should be sufficient.

Signature · 4 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
#10 lore raw

Re: XDP maintainer match (Was [PATCH v2 0/2] hwmon: (max127) Add Maxim MAX127 hardware monitoring)

Quoted 10 lines · Jesper Dangaard Brouer

On Thu, 19 Nov 2020 07:46:34 -0800 Jakub Kicinski <[email protected]> wrote:

I think it is a good idea to change the keyword (K:), but I'm not sure this catch what we want, maybe it does. The pattern match are meant to catch drivers containing XDP related bits.

Previously Joe Perches <[email protected]> suggested this pattern match, which I don't fully understand... could you explain Joe?

  (?:\b|_)xdp(?:\b|_)

This regex matches only:

xdp
xdp_<anything>
<anything>_xdp_<anything>
<anything>_xdp

Quoted 3 lines

For the filename (N:) regex match, I'm considering if we should remove it and list more files explicitly. I think normal glob * pattern works, which should be sufficient.

Lists are generally more specific than regex globs.

maintainer
#11 lore raw

Re: XDP maintainer match (Was [PATCH v2 0/2] hwmon: (max127) Add Maxim MAX127 hardware monitoring)

Quoted 19 lines · On Thu, 19 Nov 2020 09:09:53 -0800 Joe Perches wrote:
Quoted 10 lines · Jesper Dangaard Brouer

On Thu, 19 Nov 2020 07:46:34 -0800 Jakub Kicinski <[email protected]> wrote:

I think it is a good idea to change the keyword (K:), but I'm not sure this catch what we want, maybe it does. The pattern match are meant to catch drivers containing XDP related bits.

Previously Joe Perches <[email protected]> suggested this pattern match, which I don't fully understand... could you explain Joe?

  (?:\b|_)xdp(?:\b|_)

This regex matches only:

xdp
xdp_<anything>
<anything>_xdp_<anything>
<anything>_xdp

Quoted 5 lines
Quoted 3 lines

For the filename (N:) regex match, I'm considering if we should remove it and list more files explicitly. I think normal glob * pattern works, which should be sufficient.

Lists are generally more specific than regex globs.

Checking like Alexei did it seems Joe's version is faster and better:

$ git grep -l -E "[^a-z0-9]xdp[^a-z0-9]" | wc -l
295
$ git grep -l -E '(\b|_)xdp(\b|_)' | wc -l
297
$ time git grep -l -E '(\b|_)xdp(\b|_)' > /tmp/a

real 0m5.171s
user 0m32.657s
sys 0m0.664s

$ time git grep -l -E "[^a-z0-9]xdp[^a-z0-9]" > /tmp/b

real 0m16.627s
user 1m48.149s
sys 0m0.977s
09:56 linux$ diff /tmp/a /tmp/b
4d3
< Documentation/networking/index.rst
189d187
< samples/bpf/.gitignore

Joe would you like to send a patch, or should I?

#12 lore raw

Re: XDP maintainer match (Was [PATCH v2 0/2] hwmon: (max127) Add Maxim MAX127 hardware monitoring)

Quoted 26 lines · On Thu, 19 Nov 2020 09:59:28 -0800 Jakub Kicinski <[email protected]> wrote:
Quoted 19 lines · On Thu, 19 Nov 2020 09:09:53 -0800 Joe Perches wrote:
Quoted 10 lines · Jesper Dangaard Brouer

On Thu, 19 Nov 2020 07:46:34 -0800 Jakub Kicinski <[email protected]> wrote:

I think it is a good idea to change the keyword (K:), but I'm not sure this catch what we want, maybe it does. The pattern match are meant to catch drivers containing XDP related bits.

Previously Joe Perches <[email protected]> suggested this pattern match, which I don't fully understand... could you explain Joe?

  (?:\b|_)xdp(?:\b|_)

This regex matches only:

xdp
xdp_<anything>
<anything>_xdp_<anything>
<anything>_xdp

Quoted 5 lines
Quoted 3 lines

For the filename (N:) regex match, I'm considering if we should remove it and list more files explicitly. I think normal glob * pattern works, which should be sufficient.

Lists are generally more specific than regex globs.

Quoted 7 lines

Checking like Alexei did it seems Joe's version is faster and better:

$ git grep -l -E "[^a-z0-9]xdp[^a-z0-9]" | wc -l
295
$ git grep -l -E '(\b|_)xdp(\b|_)' | wc -l
297
$ time git grep -l -E '(\b|_)xdp(\b|_)' > /tmp/a

Okay, I guess this is the pattern you want: '(\b|_)xdp(\b|_)'

Quoted 1 line

Joe would you like to send a patch, or should I?

As you noticed I already send out a patch, I can send a new with your pattern, as it seems to be faster.

Signature · 4 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
#13 lore raw
In reply to Jakub Kicinski
Quoted 46 lines · Jakub Kicinski
Quoted 37 lines · On Wed, 18 Nov 2020 17:26:53 -0800 Guenter Roeck wrote:
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Quoted 6 lines

I have no idea why running get_maintainer.pl on Documentation/hwmon/index.rst returns such a large list of mailing lists and people. For some reason it includes everyone in the XDP maintainer list. If anyone has an idea how that happens, please let me know - we'll want to get this fixed to avoid the same problem in the future.

I found it. The XDP maintainer entry has:

K: xdp

This matches Documentation/hwmon/index.rst.

$ grep xdp Documentation/hwmon/index.rst
   xdpe12284
Quoted 6 lines

It seems to me that a context match such as "xdp" in MAINTAINERS isn't really appropriate. "xdp" matches a total of 348 files in the kernel. The large majority of those is not XDP related. The maintainers of XDP (and all the listed mailing lists) should not be surprised to get a large number of odd review requests if they want to review every single patch on files which include the term "xdp".

Quoted 7 lines

Agreed, we should fix this. For maintainers with high patch volume life would be so much easier if people CCed the right folks to get reviews, so we should try our best to fix get_maintainer.

XDP folks, any opposition to changing the keyword / filename to:

        [^a-z0-9]xdp[^a-z0-9]

Reducing regex makes sense.
git grep -l -E "xdp"|wc -l
348
git grep -l -E "[^a-z0-9]xdp[^a-z0-9]"|wc -l
295

The false positive match was:
+drivers/hwmon/pmbus/Kconfig +drivers/hwmon/pmbus/Makefile +drivers/hwmon/pmbus/xdpe12284.c +drivers/net/ethernet/natsemi/ns83820.c +drivers/net/ethernet/neterion/s2io.c +drivers/net/ethernet/neterion/s2io.h +drivers/net/ethernet/neterion/vxge/vxge-config.c +drivers/net/ethernet/neterion/vxge/vxge-config.h +drivers/net/ethernet/neterion/vxge/vxge-traffic.c +drivers/net/ethernet/sis/sis900.c +drivers/net/ethernet/sis/sis900.h +drivers/net/wireless/ath/ath5k/ath5k.h +drivers/net/wireless/ath/ath5k/base.c +drivers/net/wireless/ath/ath5k/debug.c +drivers/net/wireless/ath/ath5k/dma.c

so it's pretty much hwmon and few drivers.
I agree that sparing xdp from hwmon patches is a good thing :)

#14 lore raw
In reply to Tao Ren
Quoted 11 lines · Tao Ren
Quoted 10 lines · Andrew Lunn
Quoted 4 lines · On Wed, Nov 18, 2020 at 03:09:27PM -0800, [email protected] wrote:

From: Tao Ren <[email protected]>

The patch series adds hardware monitoring driver for the Maxim MAX127 chip.

Hi Tao

Why are using sending a hwmon driver to the networking mailing list?

Quoted 7 lines
Quoted 1 line

Andrew

Hi Andrew,

I added netdev because the mailing list is included in "get_maintainer.pl Documentation/hwmon/index.rst" output. Is it the right command to find reviewers? Could you please suggest? Thank you.

Hi Tae

What you are doing is correct. I suspected it was a get_maintainers problem. Now we know this, we can figure out why it is adding all these extra addresses which make no sense. Maybe a bug in the MAINTAINERS file?

Andrew