Skip to content

hwmon: add driver for ltc4284 - #3450

Open
actorreno wants to merge 62 commits into
mirror_ci/groeck/linux-staging/hwmon-nextfrom
staging/ltc4284
Open

actorreno wants to merge 62 commits into
mirror_ci/groeck/linux-staging/hwmon-nextfrom
staging/ltc4284

Conversation

@actorreno

@actorreno actorreno commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Description

The LTC4284 is a high-power hot swap controller designed for -48V distributed power systems supporting up to 2500W applications. It features dual-gate MOSFET drivers with multiple operation modes, comprehensive monitoring capabilities, and advanced protection.

Datasheet: LTC4284

This PR is for upstreaming
This is for dev branch in case some tests/features are requested: #3351
This supersedes the old draft PR #3126

Key features:

  • Dual current sensing with independent sense resistors
  • Voltage, current, power, and energy monitoring
  • Four operation modes: single, parallel, staged start (high/low stress)
  • Programmable current limiting (15mV-30mV sense voltage range)
  • Min/max history tracking with reset capability
  • Comprehensive fault detection and logging
  • I2C interface with regmap support

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch from 8411d1b to a17a53a Compare July 22, 2026 00:00
@actorreno
actorreno marked this pull request as ready for review July 22, 2026 03:41
@actorreno
actorreno requested a review from nunojsa July 22, 2026 03:42
@nunojsa

nunojsa commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

The ltc4283 driver is already upstream! Any reason this device cannot be supported in that driver?

@actorreno

Copy link
Copy Markdown
Contributor Author

I was pulled late into the project (around May), so I simply continued work until I ended up being the submitter.
(LTC4283 got upstreamed around June it seems)

I wasn't aware of ltc4283 being in the works, and I think we can't easily add on ltc4282.

Digging some history there's this #3126 that seemed to have decided why we have a separate driver code.

but now that I see LTC4283 I am inclined to just add support on it, the code overlap seems considerable compared to probable extra code lines.

@actorreno
actorreno force-pushed the staging/ltc4284 branch 9 times, most recently from b275459 to 5e45c36 Compare July 29, 2026 22:49
@actorreno

Copy link
Copy Markdown
Contributor Author

v2:

  • now adding support on top of ltc4283.c rather than its separate driver

For the gpio support, I was thinking since it's exactly the same feature, just mentioning it in kconfig was enough

@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch 8 times, most recently from ec684c3 to 16e3a40 Compare August 29, 2026 00:00
@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch 5 times, most recently from c70491f to 666afcf Compare September 3, 2026 00:00
@actorreno
actorreno changed the base branch from main to mirror_ci/groeck/linux-staging/hwmon-next September 18, 2026 00:51
The LTC4283 is a negative voltage hot swap controller that drives an
external N-channel MOSFET to allow a board to be safely inserted and
removed from a live backplane.

Note that this device has a MODE pin that is determined by differing
voltage levels (VEE, VIN, INTVCC, or left open) and cannot be
controlled via software or GPIO.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Support the LTC4284 Hot Swap Controller. It is very Similar to LTC4283 but for
higher power. The device features programmable current limit with foldback and
independently adjustable inrush current to optimize the MOSFET safe operating
area (SOA). The SOA timer limits MOSFET temperature rise for reliable
protection against overstresses.

An I2C interface and onboard ADC allow monitoring of board current,
voltage, power, energy, and fault status.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Similar to LTC4283, LTC4284 has up to 8 pins that can be configured
as GPIOs and behaves the same.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
@actorreno

Copy link
Copy Markdown
Contributor Author

PR got stale, just following up on review @nunojsa
Also cleaned the commits.
Thanks!

@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch 7 times, most recently from a7c82e2 to a249931 Compare September 25, 2026 09:33
@nunojsa nunojsa mentioned this pull request Sep 25, 2026
4 of 8 tasks

@nunojsa nunojsa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the major thing to rethink is sense1 and sense2. I think it should just be a new sense2 variable! The docs are actually wrong IMO as it looks like we can ever have curr1, curr2 and curr3 which is not the case!

description:
Value of the SENSE2 current sense resistor. Only applicable to LTC4284.
This resistor is connected between SENSE2+ and SENSE2- pins and is used
for channel 2 current measurements.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should not need those "only applicable to ltc4284". The below conditional stuff should make it clear!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see, will lessen comments like this.

then:
required:
- adi,rsense1-nano-ohms
- adi,rsense2-nano-ohms

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be nice to also add an example for the new chip

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will add

For LTC4284, this is optional and represents the sense resistor value for
current measurements via the ADC+/ADC- pins (channel 0), which depends on
the hardware connection (can be wired to SENSE1, SENSE2, or an average via
resistive divider).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would do the above change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, can I get further explanation on this?

the hardware connection (can be wired to SENSE1, SENSE2, or an average via
resistive divider).

adi,rsense1-nano-ohms:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe we can reuse adi,rsense-nano-ohms to be the first one in here?!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, possible

curr3_min_alarm Undercurrent alarm
curr3_max_alarm Overcurrent alarm
curr3_crit_alarm Critical Overcurrent alarm
curr3_label Channel label (ISENSE2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why 2 and 3? I would say we just have 1 and 2 no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was running on the assumption SENSE, SENSE1, and SENSE2 are all different, as commented below I shall double check this

Comment thread drivers/hwmon/Kconfig

config SENSORS_LTC4283
tristate "Analog Devices LTC4283"
tristate "Analog Devices LTC4283 and compatibles"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe "Similar devices"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will change

Comment thread drivers/hwmon/ltc4283.c
#define LTC4283_POWER_MIN 0x48
#define LTC4283_POWER_MAX 0x49
#define LTC4283_RESERVED_68 0x68
#define LTC4283_RESERVED_6D 0x6D

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why have you removed the above? Aren't they still reserved for ltc4283?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I was thinking this was a placeholder especially since ltc4284 uses these, but well, yeah... it doesn't make sense on the view of ltc4283, will revert.

Comment thread drivers/hwmon/ltc4283.c
/* in tenths of microohm - For LTC4284 channel 1 (SENSE1) */
u32 rsense1;
/* in tenths of microohm - For LTC4284 channel 2 (SENSE2) */
u32 rsense2;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again! For the registers defintions, sure they are different. But in here I don't see why we need two new rsense1 and 2. rsense can be repurposed to be the "rsense1" no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will try to repurpose 'rsense', but yes it should be possible

Comment thread drivers/hwmon/ltc4283.c
Comment thread drivers/hwmon/ltc4283.c
};

struct ltc4283_chip_info {
enum ltc4283_chip_id id;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that instead of an id, what we might need is has_sense2 boolean?!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will check out this out!

@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch 3 times, most recently from b328ade to e943ef6 Compare September 28, 2026 00:01
@actorreno

Copy link
Copy Markdown
Contributor Author

I think the major thing to rethink is sense1 and sense2. I think it should just be a new sense2 variable! The docs are actually wrong IMO as it looks like we can ever have curr1, curr2 and curr3 which is not the case!

yes, I may need to clarify this with apps, double check sense, sense1, sense2. would answer a lot of review points above.

@actorreno

Copy link
Copy Markdown
Contributor Author

apps replied, SENSE is just the average of SENSE1 and SENSE2 for ltc4284.
my edits would make SENSE from ltc4283 as the ltc4284 SENSE1, then I'll add SENSE2.

So ltc4283 = SENSE.
ltc4284 = SENSE and SENSE2.
similar treatment to the resistors

Will not support the average as it's not an actual real channel

@gastmaier
gastmaier force-pushed the mirror_ci/groeck/linux-staging/hwmon-next branch from e943ef6 to 935f1d8 Compare October 1, 2026 00:02

This branch has not been deployed

No deployments
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.