STRUCT SMB347_CHARGER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

NAME πŸ’–

okay so this page is literally about struct smb347_charger β€” the smb347 charger instance β€” and we're deep in the Kernel API Manual rn. bestie this is the struct that holds all the charger's main-character data, and every field is below, no cap. πŸ’…

SYNOPSIS ✨

bestie here's the whole struct, exact vibes, do not come for the semicolons:

       struct smb347_charger {
           struct device           *dev;
           struct regmap           *regmap;
           struct power_supply     *mains;
           struct power_supply     *usb;
           struct regulator_dev    *usb_rdev;
           unsigned int            id;
           bool mains_online;
           bool usb_online;
           bool irq_unsupported;
           bool usb_vbus_enabled;
           unsigned int            max_charge_current;
           unsigned int            max_charge_voltage;
           unsigned int            pre_charge_current;
           unsigned int            termination_current;
           unsigned int            pre_to_fast_voltage;
           unsigned int            mains_current_limit;
           unsigned int            usb_hc_current_limit;
           unsigned int            chip_temp_threshold;
           int soft_cold_temp_limit;
           int soft_hot_temp_limit;
           int hard_cold_temp_limit;
           int hard_hot_temp_limit;
           bool suspend_on_hard_temp_limit;
           unsigned int            soft_temp_limit_compensation;
           unsigned int            charge_current_compensation;
           bool use_mains;
           bool use_usb;
           bool use_usb_otg;
           unsigned int            enable_control;
           unsigned int            inok_polarity;
        };

Members 🫢

okay so every member gets its moment, periodt:

  • dev β€” pointer to device, aka the device this charger situation belongs to.
  • regmap β€” pointer to driver regmap, the register-map hookup.
  • mains β€” power_supply instance for AC/DC power.
  • usb β€” power_supply instance for USB power.
  • usb_rdev β€” USB VBUS regulator device, iconic.
  • id β€” SMB charger ID.
  • mains_online β€” is AC/DC input connected.
  • usb_online β€” is USB input connected.
  • irq_unsupported β€” is interrupt unsupported by SMB hardware.
  • usb_vbus_enabled β€” is USB VBUS powered by SMB charger.
  • max_charge_current β€” maximum current (in uA) the battery can be charged.
  • max_charge_voltage β€” maximum voltage (in uV) the battery can be charged.
  • pre_charge_current β€” current (in uA) to use in pre-charging phase.
  • termination_current β€” current (in uA) used to determine when the charging cycle terminates.
  • pre_to_fast_voltage β€” voltage (in uV) treshold used for transitioning to pre-charge to fast charge mode.
  • mains_current_limit β€” maximum input current drawn from AC/DC input (in uA).
  • usb_hc_current_limit β€” maximum input high current (in uA) drawn from USB input.
  • chip_temp_threshold β€” die temperature where device starts limiting charge current [100 - 130] (in degree C).
  • soft_cold_temp_limit β€” soft cold temperature limit [0 - 15] (in degree C), granularity is 5 deg C.
  • soft_hot_temp_limit β€” soft hot temperature limit [40 - 55] (in degree C), granularity is 5 deg C.
  • hard_cold_temp_limit β€” hard cold temperature limit [-5 - 10] (in degree C), granularity is 5 deg C.
  • hard_hot_temp_limit β€” hard hot temperature limit [50 - 65] (in degree C), granularity is 5 deg C.
  • suspend_on_hard_temp_limit β€” suspend charging when hard limit is hit.
  • soft_temp_limit_compensation β€” compensation method when soft temperature limit is hit.
  • charge_current_compensation β€” current (in uA) for charging compensation current when temperature hits soft limits.
  • use_mains β€” AC/DC input can be used.
  • use_usb β€” USB input can be used.
  • use_usb_otg β€” USB OTG output can be used (not implemented yet).
  • enable_control β€” how charging enable/disable is controlled (driver/pin controls).
  • inok_polarity β€” polarity of INOK signal which denotes presence of external power supply.

Description 🌸

okay so use_main, use_usb, and use_usb_otg are means to enable/disable hardware support for these. This is useful when we want to have for example OTG charging controlled via OTG transceiver driver and not by the SMB347 hardware.

Hard and soft temperature limit values are given as described in the device data sheet and assuming NTC beta value is 3750. Even if this is not the case, these values should be used. They can be mapped to the corresponding NTC beta values with the help of table 2 in the data sheet. So for example if NTC beta is 3375 and we want to program hard hot limit to be 53 deg C, hard_hot_temp_limit should be set to 50.

bestie the temp-limit numbers are datasheet-coded like that on purpose β€” even when your NTC beta isn't 3750, you still use these values, fr fr. 🫢

If zero value is given in any of the current and voltage values, the factory programmed default will be used. For soft/hard temperature values, pass in SMB3XX_TEMP_USE_DEFAULT instead.

SEE ALSO πŸ¦‹


okay bestie that's the whole page πŸ’– this one lives in ./drivers/power/supply, is dated October 2026, and is literally struct smb347_charger(9) β€” go forth and slay your charger config, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from