Skip to content

Commit 66332f3

Browse files
LeilaCY-Linjohnwc_yeh
authored andcommitted
marigold: ERS update power table setting
Signed-off-by: LeilaCY-Lin <LeilaCY_Lin@compal.com>
1 parent 85d92ea commit 66332f3

1 file changed

Lines changed: 29 additions & 49 deletions

File tree

zephyr/program/framework/marigold/src/cpu_power.c

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
1818
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
1919

20+
#define ROP 15
21+
#define batt_rating 61
22+
2023
enum battery_wattage { none, battery_55w, battery_61w };
2124
enum battery_wattage get_battery_wattage(void)
2225
{
@@ -63,58 +66,35 @@ void update_soc_power_limit(bool force_update, bool force_no_adapter)
6366
}
6467

6568
if (!extpower_is_present() || active_power == 0) {
66-
/* Battery only */
67-
pl1_watt = 25;
68-
pl2_watt = 30;
69-
if (battery_watt == battery_55w) {
70-
/* battery_55w */
71-
pl4_watt = 72;
72-
psyspl2_watt = 53;
73-
} else {
74-
/* battery_61w */
75-
pl4_watt = 80;
76-
psyspl2_watt = 58;
77-
}
78-
} else if (battery_percent > 30 && active_power >= 55) {
79-
/* ADP >= 55W and Battery percentage > 30% */
69+
/* Battery only, same for 61wh and 55wh battery */
70+
pl1_watt = 28;
71+
pl2_watt = batt_rating - ROP;
72+
pl4_watt = 80;
73+
psyspl2_watt = (batt_rating * 95) / 100;
74+
} else if (battery_watt == none && active_power >= 60) {
75+
/*Standalone mode AC only and AC >= 60W*/
76+
pl1_watt = 30;
77+
pl2_watt = 40;
78+
pl4_watt = ((active_power * 95) / 100);
79+
psyspl2_watt = ((active_power * 95) / 100);
80+
} else if (battery_percent >= 30 && active_power >= 55) {
81+
/* ADP >= 55W and Battery percentage >= 30% */
8082
pl1_watt = 30;
8183
pl2_watt = 60;
82-
83-
if (battery_watt == battery_55w) {
84-
/* battery_55w */
85-
pl4_watt = MIN((active_power + 52), 120);
86-
psyspl2_watt = ((active_power * 95) / 100) + 39;
87-
} else {
88-
/* battery_61w */
89-
pl4_watt = MIN((active_power + 60), 120);
90-
psyspl2_watt = ((active_power * 95) / 100) + 43;
91-
}
84+
pl4_watt = 120;
85+
psyspl2_watt = ((active_power * 95) / 100) + ((batt_rating * 70) / 100);
86+
} else if (battery_percent < 30 && active_power >= 55) {
87+
/* ADP >= 55W and Battery percentage < 30% */
88+
pl1_watt = 30;
89+
pl2_watt = MIN(((active_power * 90) / 100) - ROP, 60);
90+
pl4_watt = MIN(((active_power * 90) / 100) + 80, 120);
91+
psyspl2_watt = ((active_power * 95) / 100);
9292
} else {
93-
if (active_power >= 55) {
94-
/* ADP >= 55W */
95-
pl1_watt = 30;
96-
pl2_watt = MIN((((active_power * 90) / 100) - 20), 60);
97-
psyspl2_watt = ((active_power * 95) / 100);
98-
99-
if (battery_watt == battery_55w) {
100-
pl4_watt = MIN((active_power + 52), 120);
101-
} else if (battery_watt == battery_61w) {
102-
pl4_watt = MIN((active_power + 60), 120);
103-
} else {
104-
pl4_watt = MIN(active_power, 120);
105-
}
106-
107-
} else {
108-
/*ADP < 55W*/
109-
pl1_watt = 30;
110-
pl2_watt = 30;
111-
psyspl2_watt = ((active_power * 95) / 100);
112-
113-
if (battery_watt == battery_55w || battery_watt == battery_61w)
114-
pl4_watt = 80;
115-
else
116-
pl4_watt = active_power;
117-
}
93+
/*AC+DC and AC < 55W*/
94+
pl1_watt = 28;
95+
pl2_watt = batt_rating - ROP;
96+
pl4_watt = 80;
97+
psyspl2_watt = ((batt_rating * 95) / 100);
11898
}
11999

120100
if (pl1_watt != old_pl1_watt || pl2_watt != old_pl2_watt || pl4_watt != old_pl4_watt ||

0 commit comments

Comments
 (0)