devicetree-org / devicetree-specification

Devicetree Specification document source files
Apache License 2.0
849 stars 227 forks source link

Feature Request: Set max safety margin by default and implement a way to adjust it? #78

Closed Kreyren closed 1 month ago

Kreyren commented 1 month ago

Currently a lot of DTS look like (Added comment for clarity):

/*
 * Connected capacitors C644, C645, and C1524 are rated for 6.3V.
 *
 * According to Ref.8, the connected NCP134AMX105TCG and NCP134AMX100TCG regulators expect an input voltage range of 0.8V to 5.5V.
 *
 * Exceeding 5.5V (5 500 000 microvolts) will exponentially increase the risk of permanent damage to the regulators, and going beyond 6.3V will accelerate capacitor wear.
 */
vdda_cc_ebi23:
vsw_s1:
vreg_s1a_0p8: smps1 {
    regulator-min-microvolt = <800000>; // 0.8V = 800 000 microvolts
    regulator-max-microvolt = <4400000>; // 4.4V (80% of 5.5V) = 4 400 000 microvolts
}

Where we have a voltage range of 0.8 ~ 5.5V, but everyone seems to set the 80% of maximum leading to programmatically wrong code as the voltage range is inaccurate.

Instead proposing;

vdda_cc_ebi23:
vsw_s1:
vreg_s1a_0p8: smps1 {
    regulator-min-microvolt = <800000>; // 0.8V = 800 000 microvolts
    regulator-max-microvolt = <5500000>; // 5.5V = 5 500 000 microvolts
    // Proposed option, expected to be set to 80 by default and with ability to be negative to go past the set max:
    regulator-max-safety-margin = <80>; // 80% of regulator-max-microvolt
}

As to me it makes the code cleaner and logically correct while enabling easier adjustments of the safety margin e.g. in case the regulator handles GPU which might benefit from lesser safety margin

robherring commented 1 month ago

This is the regulator binding, not a spec issue. Submit patches against the regulator binding schema if you want to make additions to it. It lives in the Linux kernel tree.