Devicetree
 help / color / mirror / Atom feed
From: Akshay Gupta <Akshay.Gupta@amd.com>
To: <linux-hwmon@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>
Cc: <linux@roeck-us.net>, <robh@kernel.org>, <krzk+dt@kernel.org>,
	<conor+dt@kernel.org>, <corbet@lwn.net>,
	<skhan@linuxfoundation.org>, <rdunlap@infradead.org>,
	<arnd@arndb.de>, <gregkh@linuxfoundation.org>,
	<naveenkrishna.chatradhi@amd.com>, <Anand.Umarji@amd.com>,
	Akshay Gupta <Akshay.Gupta@amd.com>
Subject: [PATCH v1 0/4] misc: amd-sbi: add DIMM thermal sensors to sbrmi
Date: Mon, 16 Nov 2026 17:32:24 +0530	[thread overview]
Message-ID: <20261116120228.865196-1-Akshay.Gupta@amd.com> (raw)

The sbrmi hwmon device reports socket power. SB-RMI can also read the
TS0 and TS1 thermal sensors on each DIMM, which a BMC needs beside the
power attributes. This series reports those sensors as temperature
channels on the same hwmon device.

The read is mailbox command 0x48 with a Mode 1 DIMM_ADDRESS:

  bit[7]   1 (Mode 1)
  bit[6]   sensor select (0 = TS0, 1 = TS1)
  bit[5]   reserved
  bit[4]   DIMM slot
  bit[3:0] memory channel

Up to 16 DIMMs are reported, two sensors each. DIMM n is temp(n+1)
for TS0 and temp(n+17) for TS1. Each channel is labelled
DIMM_TS<t>_UMC<n>. With one DIMM per channel, n is the memory channel.
With two, n is channel * 2 + slot, and the addresses interleave
(0x80, 0x90, 0x81, ...). The temp index is the DIMM number, so a DIMM
keeps the same tempN when other sensors are left out of the map.

DataOut[31:21] is an 11-bit two's complement value in steps of
0.25 degC. The driver reports it to hwmon in millidegrees Celsius.

Boards differ in how many DIMMs are fitted per memory channel and in
which sensors are populated. Two optional firmware properties describe
that:

  amd,dpc        DIMMs per channel, 1 or 2. The default is 1.
  amd,dimm-ids   Mode 1 address of each sensor to expose. Only those
                 channels are visible. If the property is absent, all
                 32 channels are exposed, and a read of a sensor that
                 is not fitted returns the firmware error.

The binding and the driver reject an address without bit[7], with the
reserved bit[5], with the slot bit set when amd,dpc is 1, with a
memory channel above 7 when amd,dpc is 2, or listed twice. An empty
or unreadable amd,dimm-ids property is rejected as well. With one DIMM
per channel the allowed values are 0x80-0x8f and 0xc0-0xcf. With two
they are 0x80-0x87, 0x90-0x97, 0xc0-0xc7 and 0xd0-0xd7.

The mailbox transaction and the existing hwmon registration both live
in drivers/misc/amd-sbi, so the new channels are added there, on the
hwmon device the driver already publishes.

Patches:

  1. Switch sbrmi_data->lock to guard(). No functional change. The
     DIMM reads go through rmi_mailbox_xfer(), and this lets the error
     paths in that function return directly. The patch stands on its
     own.

  2. Add amd,dpc and amd,dimm-ids to the amd,sbrmi binding, and mention
     the DIMM sensors in the title, description and example.

  3. Report the sensors from rmi-hwmon: tempX_input and tempX_label,
     visibility taken from the DIMM map, and the 0.25 degC conversion.

  4. Document the temperature attributes and the DIMM-to-temp mapping
     in Documentation/hwmon/sbrmi.rst, and point to it from the SB-RMI
     section of Documentation/misc-devices/amd-sbi.rst.

Thanks,
Akshay Gupta

Prathima Lk (4):
  misc: amd-sbi: use guard() for data->lock mutex
  dt-bindings: hwmon: add DIMM thermal sensor properties
  misc: amd-sbi: add DIMM thermal sensor support
  Documentation: hwmon: document DIMM thermal sensor channels

 .../devicetree/bindings/hwmon/amd,sbrmi.yaml  |  59 ++++-
 Documentation/hwmon/sbrmi.rst                 |  37 +++
 Documentation/misc-devices/amd-sbi.rst        |   4 +-
 drivers/misc/amd-sbi/rmi-core.c               | 148 ++++++-----
 drivers/misc/amd-sbi/rmi-core.h               |  10 +
 drivers/misc/amd-sbi/rmi-hwmon.c              | 236 ++++++++++++++++--
 6 files changed, 395 insertions(+), 99 deletions(-)
-- 
2.34.1

             reply	other threads:[~2026-11-16 12:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 12:02 Akshay Gupta [this message]
2026-11-16 12:02 ` [PATCH v1 1/4] misc: amd-sbi: use guard() for data->lock mutex Akshay Gupta
2026-11-16 12:15   ` sashiko-bot
2026-11-16 12:02 ` [PATCH v1 2/4] dt-bindings: hwmon: add DIMM thermal sensor properties Akshay Gupta
2026-11-16 12:02 ` [PATCH v1 3/4] misc: amd-sbi: add DIMM thermal sensor support Akshay Gupta
2026-11-16 12:02 ` [PATCH v1 4/4] Documentation: hwmon: document DIMM thermal sensor channels Akshay Gupta

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=20261116120228.865196-1-Akshay.Gupta@amd.com \
    --to=akshay.gupta@amd.com \
    --cc=Anand.Umarji@amd.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.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=naveenkrishna.chatradhi@amd.com \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.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