From e8f8daae1b6ec85ba5c7689b684c91094efbeb25 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 5 Apr 2020 10:34:25 -0600 Subject: [PATCH] Set input current limits --- src/board/system76/darp5/battery.c | 8 ++++++++ src/board/system76/galp3-c/battery.c | 8 ++++++++ src/board/system76/lemp9/battery.c | 12 ++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/board/system76/darp5/battery.c b/src/board/system76/darp5/battery.c index 28b813e..d980519 100644 --- a/src/board/system76/darp5/battery.c +++ b/src/board/system76/darp5/battery.c @@ -34,6 +34,10 @@ int battery_charger_disable(void) { res = smbus_write(0x09, 0x15, 0); if (res < 0) return res; + // Disable input current + res = smbus_write(0x09, 0x3F, 0); + if (res < 0) return res; + return 0; } @@ -51,6 +55,10 @@ int battery_charger_enable(void) { res = smbus_write(0x09, 0x15, 0x44CB); if (res < 0) return res; + // Set input current to ~3.2 A + res = smbus_write(0x09, 0x3F, 0x0C80); + if (res < 0) return res; + // Set charge option 0 with watchdog disabled res = smbus_write( 0x09, diff --git a/src/board/system76/galp3-c/battery.c b/src/board/system76/galp3-c/battery.c index f12af07..31fa7f7 100644 --- a/src/board/system76/galp3-c/battery.c +++ b/src/board/system76/galp3-c/battery.c @@ -34,6 +34,10 @@ int battery_charger_disable(void) { res = smbus_write(0x09, 0x15, 0); if (res < 0) return res; + // Disable input current + res = smbus_write(0x09, 0x3F, 0); + if (res < 0) return res; + return 0; } @@ -51,6 +55,10 @@ int battery_charger_enable(void) { res = smbus_write(0x09, 0x15, 0x3300); if (res < 0) return res; + // Set input current to ~1.92 A + res = smbus_write(0x09, 0x3F, 0x0780); + if (res < 0) return res; + // Set charge option 0 with watchdog disabled res = smbus_write( 0x09, diff --git a/src/board/system76/lemp9/battery.c b/src/board/system76/lemp9/battery.c index 54117d4..57a9633 100644 --- a/src/board/system76/lemp9/battery.c +++ b/src/board/system76/lemp9/battery.c @@ -33,6 +33,10 @@ int battery_charger_disable(void) { res = smbus_write(0x09, 0x15, 0); if (res < 0) return res; + // Disable input current + res = smbus_write(0x09, 0x3F, 0); + if (res < 0) return res; + return 0; } @@ -42,14 +46,18 @@ int battery_charger_enable(void) { res = battery_charger_disable(); if (res < 0) return res; - // Set charge current to 3.264 A / 2 - res = smbus_write(0x09, 0x14, 0x0CF2 / 2); + // Set charge current to ~1.54A + res = smbus_write(0x09, 0x14, 0x061C); if (res < 0) return res; // Set charge voltage to 8.8 V res = smbus_write(0x09, 0x15, 0x2260); if (res < 0) return res; + // Set input current to ~3.2 A + res = smbus_write(0x09, 0x3F, 0x0C80); + if (res < 0) return res; + // Set charge option 0 with watchdog disabled res = smbus_write( 0x09,