The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: <victor.duicu@microchip.com>
To: <linux@roeck-us.net>, <robh@kernel.org>, <krzk+dt@kernel.org>,
	<conor+dt@kernel.org>, <corbet@lwn.net>
Cc: <marius.cristea@microchip.com>, <victor.duicu@microchip.com>,
	<linux-hwmon@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-doc@vger.kernel.org>
Subject: [PATCH v3 0/2] add support in hwmon for MCP998X
Date: Tue, 27 Jan 2026 17:18:20 +0200	[thread overview]
Message-ID: <20260127151823.9728-1-victor.duicu@microchip.com> (raw)

From: Victor Duicu <victor.duicu@microchip.com>

Add support in hwmon for Microchip MCP998X/33 and MCP998XD/33D Multichannel
Automotive Temperature Monitor Family.

The chips in the family have different numbers of external channels,
ranging from 1 (MCP9982) to 4 channels (MCP9985).
Reading diodes in anti-parallel connection is supported by MCP9984/85/33
and MCP9984D/85D/33D. Dedicated hardware shutdown circuitry is present
only in MCP998XD and MCP9933D.

The driver supports reading the temperature channels, the temperature
limits and their corresponding alarms. The user can set the limits,
the update interval and the hysteresis.

This driver is based on the IIO driver for MCP998X:
https://lore.kernel.org/all/20250930133131.13797-1-victor.duicu@microchip.com/

Differences related to previous patch:
v3:
- update copyright year.
- add tempX_max_hyst and tempX_crit_hyst attributes and document
  them in mcp9982.rst. 
- in include list add byteorder/generic.h and remove unaligned.h.
- remove definitions for temperature memory block
  and status memory block.
- remove individual definitions for register addresses 1Dh->21h.
- add constants MCP9982_WAKE_UP_TIME_MAX_US and
  MCP9982_TIMER_BUFFER_US.
- add checks to ensure that values read from registers are on 8 bits.
- in mcp9982_read_limit() simplify calculation, replace bulk read
  with individual operations and add comment.
- in mcp9982_read_limit() add explicit case branches for limits
  that are on 16 bits.
- in mcp9982_read() replace mdelay() with usleep_range().
- in mcp9982_read() replace block reading for temperature values with
  individual operations, add comment and remove unnecessary
  mask variable.
- in regmap_read_poll_timeout() add final timeout.
- in mcp9982_read_label() remove label check.
- in mcp9982_write_limit() replace put_unaligned_be16() with cpu_to_be16().
- in mcp9982_write_limit() add explicit case branches for limits
  that are on 16 bits.
- in mcp9982_init() write default value for diode alert mask register.
- in mcp9982_parse_fw_config() replace E2BIG with EINVAL.

v2:
- in Kconfig add select REGMAP_I2C.
- in yaml add power state attribute. For chips with "D" in the name
  check that Run mode is set in yaml and driver.
- in the include list: remove cleanup.h, add math.h, minmax.h and
  util_macros.h.
- add min, max and crit limits for all channels. These attributes can
  be read and written. In mcp9982_init() set default values for limits.
- add alarms for limits.
- edit regmap ranges to add the limit registers.
- when writing update interval, don't force the user to set exact value.
  Search for closest valid value.
- in mcp9982_parse_fw_config() check value from fwnode_property_read_u32().
- edit coding style and comments.
- remove constant MCP9982_SCALE.
- rename variable sampl_idx from mcp9982_priv to interval_idx.
- in mcp9982_write() rename variable use_previous_freq
  to use_previous_interval.

v1:
- initial version for review.

Victor Duicu (2):
  dt-bindings: hwmon: add support for MCP998X
  hwmon: add support for MCP998X

 .../bindings/hwmon/microchip,mcp9982.yaml     |  205 ++++
 Documentation/hwmon/index.rst                 |    1 +
 Documentation/hwmon/mcp9982.rst               |  105 ++
 MAINTAINERS                                   |    8 +
 drivers/hwmon/Kconfig                         |   11 +
 drivers/hwmon/Makefile                        |    1 +
 drivers/hwmon/mcp9982.c                       | 1022 +++++++++++++++++
 7 files changed, 1353 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,mcp9982.yaml
 create mode 100644 Documentation/hwmon/mcp9982.rst
 create mode 100644 drivers/hwmon/mcp9982.c


base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
-- 
2.51.0


             reply	other threads:[~2026-01-27 15:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 15:18 victor.duicu [this message]
2026-01-27 15:18 ` [PATCH v3 1/2] dt-bindings: hwmon: add support for MCP998X victor.duicu
2026-02-03 19:15   ` Guenter Roeck
2026-02-06 14:17     ` Victor.Duicu
2026-02-06 16:49       ` Krzysztof Kozlowski
2026-02-06 16:51         ` Krzysztof Kozlowski
2026-02-06 16:47   ` Krzysztof Kozlowski
2026-02-09 14:46     ` Victor.Duicu
2026-01-27 15:18 ` [PATCH v3 2/2] " victor.duicu
2026-01-27 18:51   ` Guenter Roeck
2026-02-02  8:15     ` Victor.Duicu
2026-02-02 15:18       ` Guenter Roeck
2026-02-03 13:31         ` Victor.Duicu
2026-01-27 22:23   ` kernel test robot
2026-02-03 19:45   ` Guenter Roeck
2026-02-03 20:09   ` Guenter Roeck
2026-02-03 20:45   ` Guenter Roeck
2026-02-06 16:55 ` [PATCH v3 0/2] add support in hwmon " Krzysztof Kozlowski

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=20260127151823.9728-1-victor.duicu@microchip.com \
    --to=victor.duicu@microchip.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=marius.cristea@microchip.com \
    --cc=robh@kernel.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