Skip to content

hwmon: add Altera SoC FPGA hardware monitoring support

[email protected] linux-doc linux-hwmon lkml 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 7 repliesIn review
  2. v72 patches 2 repliesSuperseded
  3. v62 patches 4 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v52 patches2 repliesSuperseded
v42 patches2 repliesSuperseded
v32 patches6 repliesSuperseded
v22 patches2 repliesSuperseded
v15 patches5 repliesSuperseded

Changes in v8 from the cover letter

- In Patch 2, address maintainer and Sashiko review feedback on socfpga-hwmon driver:
- Drop the extra wait_for_completion() after sync-mode timeout; on timeout report -ETIMEDOUT and call stratix10_svc_done(). The previous wait could hang forever if receive_cb is never invoked (e.g. BUSY/REJECTED for HWMON). Any leftover svc_fifo race will be handled in a separate stratix10-svc series.
- Place socfpga-hwmon alphabetically in Documentation/hwmon/index.rst
- No functional changes in Patch 1

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2firmware: stratix10-svc: add async HWMON read commands and register socfpga-hwmon devicedrivers/firmware/stratix10-svc.c include/linux/firmware/intel/stratix10-smc.h+81 -34 replies
2/2hwmon: add Altera SoC FPGA hardware monitoring driverDocumentation/hwmon/index.rst Documentation/hwmon/socfpga-hwmon.rst MAINTAINERS +3 more+633 -03 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchGuenter Roeck
1/2
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/2] hwmon: add Altera SoC FPGA hardware monitoring support

From: Tze Yee Ng <[email protected]>

This series adds hardware monitor support for Altera SoC FPGA devices. Temperature and voltage sensors are accessed through the Stratix 10 service layer and Secure Device Manager (SDM).

Patch 1 adds async HWMON SMC support to stratix10-svc and registers the socfpga-hwmon platform device.

Patch 2 adds the socfpga-hwmon driver, documentation, Kconfig, and MAINTAINERS entry.

Changes in v8:
- In Patch 2, address maintainer and Sashiko review feedback on socfpga-hwmon driver:
- Drop the extra wait_for_completion() after sync-mode timeout; on timeout report -ETIMEDOUT and call stratix10_svc_done(). The previous wait could hang forever if receive_cb is never invoked (e.g. BUSY/REJECTED for HWMON). Any leftover svc_fifo race will be handled in a separate stratix10-svc series.
- Place socfpga-hwmon alphabetically in Documentation/hwmon/index.rst
- No functional changes in Patch 1

Changes in v7:
- In Patch 2, address maintainer and Sashiko review feedback on socfpga-hwmon:
- Break out of the async poll loop on hard errors and return the real poll status instead of rewriting it to -ETIMEDOUT
- Drop redundant async poll alert/debug messages (SVC already logs)
- Replace msleep(1) with usleep_range() for short retries
- On sync-mode timeout, wait for the outstanding SVC callback before calling stratix10_svc_done() so a leftover svc_fifo request cannot desynchronize later sensor reads; still report -ETIMEDOUT
- No functional changes in Patch 1

Changes in v6:
- Rebase on torvalds/master (given “Linux 7.2-rc4”)
- No functional changes in Patch 1 and Patch 2

Changes in v5:
- Rebase on dinguyen/socfpga_svc_fixes_for_v7.2
- Address Sashiko review feedback on socfpga-hwmon (Patch 2):
- Poll async responses until HWMON_TIMEOUT instead of a fixed 3-iteration retry loop (~3 ms), fixing premature timeouts on silicon
- Add MODULE_ALIAS("platform:socfpga-hwmon")
- No functional changes in Patch 1

Changes in v4:
- Address maintainer and review feedback on socfpga-hwmon (Patch 2):
- Register devm_add_action_or_reset() before devm_hwmon_device_register_with_info() to fix devres teardown order
- Remove unreferenced completion and pre-poll wait_for_completion_io_timeout() from async reads; poll directly with a retry loop after async_send()
- No functional changes in Patch 1

Changes in v3:
- Address review feedback on socfpga-hwmon (Patch 2):
- Fix 16-bit Q8.8 temperature sign extension
- Drop unused async callback; pass NULL to stratix10_svc_async_send()
- Document and retain pre-poll wait (RSU pattern; firmware needs time before async_poll())
- Align async poll retry behaviour with RSU
- Use uninterruptible wait_for_completion_timeout() for sync reads
- Handle -EINVAL and -EOPNOTSUPP when falling back to sync mode
- Defer SVC channel cleanup via devm_add_action_or_reset()
- No functional changes in Patch 1

Changes in v2:
- Drop altr,stratix10-hwmon DT binding and intel,stratix10-svc hwmon child property
- Drop Stratix 10 SoCDK DTS hwmon node
- Register socfpga-hwmon from stratix10-svc (RSU-style)
- Replace DT channel parsing with hardcoded Stratix 10 and Agilex tables
- Rename driver/module to socfpga-hwmon (CONFIG_SENSORS_ALTERA_SOCFPGA_HWMON)
- Add Agilex channel support
- Fix SDM value conversion (Q8.8 degrees Celsius and Q16 volts to hwmon millidegrees/millivolts)
- Improve sync-mode error handling via last_err

Previous version:
https://lore.kernel.org/all/[email protected]/

Tze Yee Ng (2):
firmware: stratix10-svc: add async HWMON read commands and register
socfpga-hwmon device
hwmon: add Altera SoC FPGA hardware monitoring driver

 Documentation/hwmon/index.rst                |   1 +
 Documentation/hwmon/socfpga-hwmon.rst        |  34 ++
 MAINTAINERS                                  |   8 +
 drivers/firmware/stratix10-svc.c             |  46 +-
 drivers/hwmon/Kconfig                        |  10 +
 drivers/hwmon/Makefile                       |   1 +
 drivers/hwmon/socfpga-hwmon.c                | 579 +++++++++++++++++++
 include/linux/firmware/intel/stratix10-smc.h |  38 ++
 8 files changed, 714 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/hwmon/socfpga-hwmon.rst
 create mode 100644 drivers/hwmon/socfpga-hwmon.c
Signature · 1 line
2.43.7