Skip to content

ram_temp: add jc42 for DDR4#1945

Open
morph027 wants to merge 2 commits intoflightlessmango:masterfrom
morph027:ram_temp_with_jc42
Open

ram_temp: add jc42 for DDR4#1945
morph027 wants to merge 2 commits intoflightlessmango:masterfrom
morph027:ram_temp_with_jc42

Conversation

@morph027
Copy link
Copy Markdown

@morph027 morph027 commented Jan 15, 2026

Screenshot From 2026-01-15 20-00-01

Steps taken (on my Gigabyte Aorus B550 Pro V2 with G.Skill Ripjaws F4-3600C14Q @ Samsung B-Dies):

  • load module: modprobe jc42
  • verify:
❯ grep jc42 /sys/class/hwmon/hwmon*/name
/sys/class/hwmon/hwmon8/name:jc42
/sys/class/hwmon/hwmon9/name:jc42
❯ cat /sys/class/hwmon/hwmon8/temp1_input
28437

On my board, sudo i2cdetect -l does not list any SMBus for the sensors, so i needed to perform the following step (might be optional):

  • add acpi_enforce_resources=lax to kernel commandline and reboot

@pallaswept
Copy link
Copy Markdown

  • add acpi_enforce_resources=lax to kernel commandline and reboot

This should not be necessary, the jc42 driver does not use any ACPI resources. It talks to the memory over i2c, but perhaps there's an issue with the i2c driver on your motherboard. I'd have to see the error message generated when you're not running that param, to know. I deal with this driver quite a lot, and I've never once seen a board that needs this param for jc42 to load. In any case, the param is required when the motherboard reserves ACPI memory and the driver will not load because it wants to use them, so it's always motherboard-specific whether it is needed.

This module was updated in November '24, so in most cases with a kernel from the last year or so, it will load automatically. Most users with DDR4 ram have working temperature sensors already and don't even know it :)

Anyway thanks OP! I saw mention of this config option in a goverlay commit and was like "why no jc42? I might go fix that" and here you are beat me to it :)

@morph027
Copy link
Copy Markdown
Author

morph027 commented Jan 16, 2026

The module itself does load indeed, but i2c is missing the buses. I'm running Fedora kernel 6.18 with jc42@rhelversion 10.99 🤷‍♀️ My board also has some other quirks, so probably it's the one to blame. Googling around for acpi_enforce_resources=lax also shows a lot more people requiring this for other boards too.

But anyhow, great to hear that it should work out of the box. Just left the comment to make sure future users are able to use it if they stumble upon the same.

Signed-off-by: morph027 <stefan.heitmueller@gmx.com>
Comment thread src/memory.cpp Outdated
auto dirs = ls(path.c_str(), "hwmon", LS_DIRS);
for (auto &dir : dirs) {
if (read_line(path + dir + "/name") == "spd5118")
if (read_line(path + dir + "/name") == "spd5118" or read_line(path + dir + "/name") == "jc42")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every call to read_line reads the file (although it's in RAM)

We should read once and then compare all instead

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tried it but i've never been into C++ and did not figured it out how to do.

I was trying something like a list comprehension in python if .... in ["spd5118", "jc42"].

Help is appreciated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto aaa = ...;
if (aaa == "bbb" || aaa == "ccc")
...

It's not convenient to do in like Python in C++ so we usually just compare one by one 😂

Copy link
Copy Markdown
Contributor

@Henry-ZHR Henry-ZHR Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well actually we could do something like

static const std::set<std::string> SET{"bbb", "ccc"};
if (SET.contains(aaa)) ...

but I doubt whether it's better in performance

Note that constructing a std::set is expensive so it's not good to construct one every time

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed an update.

Signed-off-by: morph027 <stefan.heitmueller@gmx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants