Currently there's various hard-coded values for USB charge current limits.
For example,
driver/bc12/bq24392.c:89: new_chg.current = is_chg_det_activated(cfg) ? 2400 : 500;
driver/bc12/pi3usb9281.c:209: current_limit_ma = 2400;
As noted here by mdh, crrev.com/c/1123658, who also pointed out it would be good to unify these constants to avoid confusion as to why the particular value was chosen. Lets do it.
Mark's proposal to add to usb_charge.h
#define MAX_RAMP_SDP_mA 500
#define MAX_RAMP_CDP_mA 1500
#define MAX_RAMP_DCP_mA 2000
#define MAX_RAMP_APPLE2.0_mA 2000
#define MAX_RAMP_APPLE2.4_mA 2400
/* Use this when you can tell it is a charger, but don't know DCP vs Apple */
#define MAX_RAMP_CHARGER_DET_mA 2000
Note, usb_charge.h does have one of these already:
/* USB charger minimum current */
#define USB_CHARGER_MIN_CURR_MA 500
w/ a few usages,
common/usb_charger.c:33: charge.current = USB_CHARGER_MIN_CURR_MA;
driver/charger/rt946x.c:898: return USB_CHARGER_MIN_CURR_MA;
Anyone feel strongly about the prefix?
I'd propose 'USB_CHARGER_CUR' as the prefix ... for example
#define USB_CHARGER_CUR_SDP_MA 500