Fix charger values, again (#303)
* common: Add macros for min, max, clamp Simple macros, with no type checking. Signed-off-by: Tim Crawford <tcrawford@system76.com> * charger: Limit charger values to max valid value Use the maximum valid value instead of discarding bits. Fixes:6295f60172
("Fix smart charger values") Signed-off-by: Tim Crawford <tcrawford@system76.com> * charger/bq24780s: Fix charge current mask bq24780s uses bit 12 for 4096 a current weight. Fixes:6295f60172
("Fix smart charger values") Signed-off-by: Tim Crawford <tcrawford@system76.com> * oryp: Reduce charge current to 2A Signed-off-by: Tim Crawford <tcrawford@system76.com> * charger/bq24780s: Set RSENSE ratio option Signed-off-by: Tim Crawford <tcrawford@system76.com> Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
@@ -13,4 +13,8 @@
|
||||
|
||||
#define BIT(X) (1UL << (X))
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define CLAMP(val, min, max) (MIN(MAX(val, min), max))
|
||||
|
||||
#endif // _COMMON_MACRO_H
|
||||
|
Reference in New Issue
Block a user