* [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support
@ 2022-04-26 7:18 Zev Weiss
2022-04-26 7:18 ` [PATCH v3 1/6] dt-bindings: trivial-devices: Add Nuvoton Super I/O chips Zev Weiss
2022-04-26 8:29 ` [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
0 siblings, 2 replies; 6+ messages in thread
From: Zev Weiss @ 2022-04-26 7:18 UTC (permalink / raw)
To: Guenter Roeck, Jean Delvare, linux-hwmon
Cc: Zev Weiss, Renze Nicolai, Oleksandr Natalenko, openbmc,
linux-kernel, Rob Herring, Krzysztof Kozlowski, devicetree
Hello,
This is v3 of my effort to add i2c support to the nct6775 hwmon
driver.
Changes since v2 [0]:
- Fixed wrong parenthesization in nct6775_write_value()
- Moved DT binding to trivial-devices.yml instead of a dedicated file
[Guenter]
- Renamed drivers and Kconfig symbols to keep existing platform
driver as "nct6775" (SENSORS_NCT6775) and the core module as
"nct6775-core" (SENSORS_NCT6775_CORE) [Guenter]
- Fixed SENSORS_NCT6775_CORE Kconfig to select REGMAP, removed
erroneous REGMAP_I2C selection from SENSORS_NCT6775_I2C [Guenter]
Changes since v1 [1]:
- Added preparatory patch converting driver to regmap API [Guenter]
- Replaced ENOSPC with ENOBUFS and removed WARN_ON() in
nct6775_add_attr_group() [Guenter]
- Added dedicated symbol namespace [Guenter]
- Removed nct6775_write_temp() and nct6775_update_device() symbol
exports [Guenter]
- Reordered patches to put dt-bindings patch first [Krzysztof]
[0] https://lore.kernel.org/linux-hwmon/20220309005047.5107-1-zev@bewilderbeest.net/
[1] https://lore.kernel.org/linux-hwmon/20220226133047.6226-1-zev@bewilderbeest.net/
A slightly edited version of the previous cover letter follows:
This patch series augments the existing nct6775 driver with support
for the hardware's i2c interface; along the way it converts the driver
to use the regmap API, and splits the LPC-specific platform driver
into a separate module from the interface-independent core.
Thus far the nct6775 driver has only supported the LPC interface,
which is the main interface by which the Super-I/O chip is typically
connected to the host (x86) processor.
However, these chips also provide an i2c interface, which can provide
a way for a BMC to also monitor sensor readings from them. On some
systems (such as the ASRock Rack ROMED8HM3 and X570-D4U) this may be
the only way for the BMC to monitor host CPU temperatures (e.g. to
indirectly access a TSI interface); this functionality is thus an
important component of enabling OpenBMC to support such systems.
In such an arrangement the Super-I/O chip is simultaneously controlled
by two independent processors (the host and the BMC) which typically
do not coordinate their accesses with each other. In order to avoid
conflicts between the two, the i2c driver avoids all writes to the
device, since the BMC's needs with the hardware are merely that it be
able to retrieve sensor readings. This allows the host processor to
remain ultimately in control of the chip and unaware of the BMC's use
of it at all.
The sole exception to the "no writes" rule for the i2c driver is for
the bank-select register -- while I haven't been able to find any
explicit statement in the Nuvoton datasheets guaranteeing this,
testing via manual register accesses (as detailed in [2]) has
indicated that, as one might hope, the i2c interface has its own
bank-select register independent of the one used by the LPC interface.
In terms of code structure, the approach taken in this series is to
first convert the driver's register accesses to the regmap API, and
then split the LPC-specific parts of it out into a separate module
(retaining the current "nct6775" name), leaving the
interface-independent parts in a generic driver (called nct6775-core).
The nct6775-i2c driver is then added as an additional consumer of the
nct6775-core module's functionality (essentially just providing its
own set of regmap read/write callback functions).
The first patch adds the chips supported by the nct6775 driver to
Documentation/device-tree-bindings/trivial-devices.yml. The second
patch contains the change to convert all register accesses to use a
regmap. The third and fourth patches make some relatively small
infrastructural changes to the driver. The core/platform driver split
is in the fifth patch, and the final patch adds the i2c driver itself.
The nct6775 and nct6775-i2c drivers have both been tested on the
NCT6779D in an ASRock ROMED8HM3 system and the NCT6798 [3] in an
ASRock X570-D4U (the latter thanks to Renze, CCed); both seem to work
as expected on both systems. I don't have access to any asuswmi
hardware, so testing of the nct6775-platform driver on that to ensure
it doesn't break there would be appreciated (Oleksandr, perhaps?).
Thanks,
Zev
[2] https://lore.kernel.org/linux-hwmon/YhttzgDtGpcTniyw@hatter.bewilderbeest.net/
[3] Though it's physically labeled (mislabeled?) as an NCT6796, for
what that's worth.
Zev Weiss (6):
dt-bindings: trivial-devices: Add Nuvoton Super I/O chips
hwmon: (nct6775) Convert register access to regmap API
hwmon: (nct6775) Rearrange attr-group initialization
hwmon: (nct6775) Add read-only mode
hwmon: (nct6775) Split core and platform driver
hwmon: (nct6775) Add i2c driver
.../devicetree/bindings/trivial-devices.yaml | 14 +
MAINTAINERS | 10 +-
drivers/hwmon/Kconfig | 30 +-
drivers/hwmon/Makefile | 2 +
drivers/hwmon/{nct6775.c => nct6775-core.c} | 2310 +++-----
drivers/hwmon/nct6775-core.h | 252 +
drivers/hwmon/nct6775-i2c.c | 179 +
drivers/hwmon/nct6775.c | 4652 ++---------------
8 files changed, 1410 insertions(+), 6039 deletions(-)
copy drivers/hwmon/{nct6775.c => nct6775-core.c} (69%)
create mode 100644 drivers/hwmon/nct6775-core.h
create mode 100644 drivers/hwmon/nct6775-i2c.c
--
2.36.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/6] dt-bindings: trivial-devices: Add Nuvoton Super I/O chips
2022-04-26 7:18 [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
@ 2022-04-26 7:18 ` Zev Weiss
2022-04-26 8:29 ` [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
1 sibling, 0 replies; 6+ messages in thread
From: Zev Weiss @ 2022-04-26 7:18 UTC (permalink / raw)
To: Guenter Roeck, Jean Delvare, linux-hwmon, Rob Herring, devicetree
Cc: Zev Weiss, Renze Nicolai, Oleksandr Natalenko, openbmc,
linux-kernel, Krzysztof Kozlowski
These Super I/O chips have an i2c interface that some systems expose
to a BMC, which may have it described in its device tree.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
---
.../devicetree/bindings/trivial-devices.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 550a2e5c9e05..2262dec4289e 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -277,6 +277,20 @@ properties:
- national,lm85
# I2C ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator
- national,lm92
+ # Nuvoton Super I/O chips
+ - nuvoton,nct6775
+ - nuvoton,nct6106
+ - nuvoton,nct6116
+ - nuvoton,nct6775
+ - nuvoton,nct6776
+ - nuvoton,nct6779
+ - nuvoton,nct6791
+ - nuvoton,nct6792
+ - nuvoton,nct6793
+ - nuvoton,nct6795
+ - nuvoton,nct6796
+ - nuvoton,nct6797
+ - nuvoton,nct6798
# i2c trusted platform module (TPM)
- nuvoton,npct501
# i2c trusted platform module (TPM2)
--
2.36.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support
2022-04-26 7:18 [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
2022-04-26 7:18 ` [PATCH v3 1/6] dt-bindings: trivial-devices: Add Nuvoton Super I/O chips Zev Weiss
@ 2022-04-26 8:29 ` Zev Weiss
2022-04-26 8:45 ` Joel Stanley
2022-04-26 8:57 ` Guenter Roeck
1 sibling, 2 replies; 6+ messages in thread
From: Zev Weiss @ 2022-04-26 8:29 UTC (permalink / raw)
To: Guenter Roeck, Jean Delvare, linux-hwmon
Cc: Renze Nicolai, Oleksandr Natalenko, openbmc, linux-kernel,
Rob Herring, Krzysztof Kozlowski, devicetree, webmaster
[Adding korg webmaster re: list infrastructure]
On Tue, Apr 26, 2022 at 12:18:42AM PDT, Zev Weiss wrote:
>Hello,
>
>This is v3 of my effort to add i2c support to the nct6775 hwmon
>driver.
>
>Changes since v2 [0]:
> ...
> - Renamed drivers and Kconfig symbols to keep existing platform
> driver as "nct6775" (SENSORS_NCT6775) and the core module as
> "nct6775-core" (SENSORS_NCT6775_CORE) [Guenter]
Unfortunately while this was a simple enough change to make (a few 'git
mv' commands and a handful of actual text changes), it ballooned the
size of the diff for patch 5 to the point that vger bounced it for
exceeding the 100K message-size limit. As far as I can tell it looks
like it went through elsewhere, but does leave a bit of a gap in the
public list archives -- please let me know if there's anything I should
try in terms of re-sending it. (The only combination of 'git
format-patch' flags I've been able to find that gets it back down to
approximately its previous size is '-B -D', which isn't so useful for
actually applying.)
I'm not sure how critical a limit that 100K is, or if it's something we
might consider raising a bit?
Thanks,
Zev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support
2022-04-26 8:29 ` [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
@ 2022-04-26 8:45 ` Joel Stanley
2022-04-26 8:57 ` Guenter Roeck
1 sibling, 0 replies; 6+ messages in thread
From: Joel Stanley @ 2022-04-26 8:45 UTC (permalink / raw)
To: Zev Weiss
Cc: Guenter Roeck, Jean Delvare, linux-hwmon, devicetree, webmaster,
OpenBMC Maillist, Linux Kernel Mailing List, Krzysztof Kozlowski,
Oleksandr Natalenko, Rob Herring, Renze Nicolai
On Tue, 26 Apr 2022 at 08:29, Zev Weiss <zev@bewilderbeest.net> wrote:
>
> [Adding korg webmaster re: list infrastructure]
>
> On Tue, Apr 26, 2022 at 12:18:42AM PDT, Zev Weiss wrote:
> >Hello,
> >
> >This is v3 of my effort to add i2c support to the nct6775 hwmon
> >driver.
> >
> >Changes since v2 [0]:
> > ...
> > - Renamed drivers and Kconfig symbols to keep existing platform
> > driver as "nct6775" (SENSORS_NCT6775) and the core module as
> > "nct6775-core" (SENSORS_NCT6775_CORE) [Guenter]
>
> Unfortunately while this was a simple enough change to make (a few 'git
> mv' commands and a handful of actual text changes), it ballooned the
> size of the diff for patch 5 to the point that vger bounced it for
> exceeding the 100K message-size limit. As far as I can tell it looks
> like it went through elsewhere, but does leave a bit of a gap in the
> public list archives -- please let me know if there's anything I should
> try in terms of re-sending it. (The only combination of 'git
> format-patch' flags I've been able to find that gets it back down to
> approximately its previous size is '-B -D', which isn't so useful for
> actually applying.)
FWIW, I moderated it through to the openbmc list, which is on lore:
https://lore.kernel.org/openbmc/YmetYjSKFs+WWwYz@hatter.bewilderbeest.net/
So the series can be fetched with eg. b4.
Aside from the mega-diff in patch 5 the changes look good to me (If
you can think of a way that makes patch 5 easier to review then let me
know).
Reviewed-by: Joel Stanley <joel@jms.id.au>
>
> I'm not sure how critical a limit that 100K is, or if it's something we
> might consider raising a bit?
>
>
> Thanks,
> Zev
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support
2022-04-26 8:29 ` [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
2022-04-26 8:45 ` Joel Stanley
@ 2022-04-26 8:57 ` Guenter Roeck
2022-04-26 19:38 ` Zev Weiss
1 sibling, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2022-04-26 8:57 UTC (permalink / raw)
To: Zev Weiss, Jean Delvare, linux-hwmon
Cc: Renze Nicolai, Oleksandr Natalenko, openbmc, linux-kernel,
Rob Herring, Krzysztof Kozlowski, devicetree, webmaster
On 4/26/22 01:29, Zev Weiss wrote:
> [Adding korg webmaster re: list infrastructure]
>
> On Tue, Apr 26, 2022 at 12:18:42AM PDT, Zev Weiss wrote:
>> Hello,
>>
>> This is v3 of my effort to add i2c support to the nct6775 hwmon
>> driver.
>>
>> Changes since v2 [0]:
>> ...
>> - Renamed drivers and Kconfig symbols to keep existing platform
>> driver as "nct6775" (SENSORS_NCT6775) and the core module as
>> "nct6775-core" (SENSORS_NCT6775_CORE) [Guenter]
>
> Unfortunately while this was a simple enough change to make (a few 'git mv' commands and a handful of actual text changes), it ballooned the size of the diff for patch 5 to the point that vger bounced it for exceeding the 100K message-size limit. As far as I can tell it looks like it went through elsewhere, but does leave a bit of a gap in the public list archives -- please let me know if there's anything I should try in terms of re-sending it. (The only combination of 'git format-patch' flags I've been able to find that gets it back down to approximately its previous size is '-B -D', which isn't so useful for actually applying.)
>
> I'm not sure how critical a limit that 100K is, or if it's something we might consider raising a bit?
>
You could split it up further. For example, you could introduce
the include file first. Also, please run checkpatch --strict on
your patches. I don't care about commenting the mutex, but there
should be no double empty lines. Also, while you are at it,
it would be great if you can add another patch to fix the
WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
warnings.
Anyway, I wondered what changed... oh, I see. You didn't rename
nct6775.c. I didn't suggest that. The new file name was fine.
I only asked you to change the Kconfig symbols, not the file names.
It is ok and actually desirable to change the file names.
The platform driver module can and should still be named nct6775;
that can be handled in the Makefile with something like
nct6775-objs := nct6775-platform.o
obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o
Guenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support
2022-04-26 8:57 ` Guenter Roeck
@ 2022-04-26 19:38 ` Zev Weiss
0 siblings, 0 replies; 6+ messages in thread
From: Zev Weiss @ 2022-04-26 19:38 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jean Delvare, linux-hwmon, Renze Nicolai, Oleksandr Natalenko,
openbmc, linux-kernel, Rob Herring, Krzysztof Kozlowski,
devicetree, webmaster
On Tue, Apr 26, 2022 at 01:57:40AM PDT, Guenter Roeck wrote:
>On 4/26/22 01:29, Zev Weiss wrote:
>>[Adding korg webmaster re: list infrastructure]
>>
>>On Tue, Apr 26, 2022 at 12:18:42AM PDT, Zev Weiss wrote:
>>>Hello,
>>>
>>>This is v3 of my effort to add i2c support to the nct6775 hwmon
>>>driver.
>>>
>>>Changes since v2 [0]:
>>>...
>>>- Renamed drivers and Kconfig symbols to keep existing platform
>>> driver as "nct6775" (SENSORS_NCT6775) and the core module as
>>> "nct6775-core" (SENSORS_NCT6775_CORE) [Guenter]
>>
>>Unfortunately while this was a simple enough change to make (a few 'git mv' commands and a handful of actual text changes), it ballooned the size of the diff for patch 5 to the point that vger bounced it for exceeding the 100K message-size limit. As far as I can tell it looks like it went through elsewhere, but does leave a bit of a gap in the public list archives -- please let me know if there's anything I should try in terms of re-sending it. (The only combination of 'git format-patch' flags I've been able to find that gets it back down to approximately its previous size is '-B -D', which isn't so useful for actually applying.)
>>
>>I'm not sure how critical a limit that 100K is, or if it's something we might consider raising a bit?
>>
>
>You could split it up further. For example, you could introduce
>the include file first. Also, please run checkpatch --strict on
>your patches. I don't care about commenting the mutex, but there
>should be no double empty lines. Also, while you are at it,
>it would be great if you can add another patch to fix the
>
>WARNING: Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'.
>
>warnings.
Ack -- hadn't been aware of the --strict flag for checkpatch, thanks.
I'll do that in v4.
>
>Anyway, I wondered what changed... oh, I see. You didn't rename
>nct6775.c. I didn't suggest that. The new file name was fine.
>I only asked you to change the Kconfig symbols, not the file names.
>It is ok and actually desirable to change the file names.
>The platform driver module can and should still be named nct6775;
>that can be handled in the Makefile with something like
>
>nct6775-objs := nct6775-platform.o
>obj-$(CONFIG_SENSORS_NCT6775) += nct6775.o
>
Got it, will revert to the previous file names, which should sidestep
the message-size problem.
Thanks,
Zev
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-26 19:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 7:18 [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
2022-04-26 7:18 ` [PATCH v3 1/6] dt-bindings: trivial-devices: Add Nuvoton Super I/O chips Zev Weiss
2022-04-26 8:29 ` [PATCH v3 0/6] hwmon: (nct6775) Convert to regmap, add i2c support Zev Weiss
2022-04-26 8:45 ` Joel Stanley
2022-04-26 8:57 ` Guenter Roeck
2022-04-26 19:38 ` Zev Weiss
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).