In ToT and firmware branches, we often copy/paste/modify entire board directories.
Do an analysis of ToT and the last couple of branches (e.g. reef) to determine how we can move more code to common/ or drivers/.
We've done that in the past with LED and battery/charging configuration. We're likely due for another round.
Here are some more low-hanging fruits:
tcpc_get_alert_status() - Move to common, need to standardize some GPIO naming.
pd_is_valid_input_voltage() - Only used by samus_pd, don't require definition.
board_is_vbus_too_low() - Can be defined in common, with exception of samus_pd.
pd_custom_vdm() - Move to common, with various VDO_CMD_* support behind #ifdefs.
svdm_dp_* - Move to common, two main options (w/ HPD GPIO and w/o).
svdm_gfu_* - I don't think we need support for this VDM on most of our devices.
'struct battery_info' - start_charging_min_c / start_charging_max_c fields are unused, seems like a bug.
board_cut_off_battery() - Almost without exception, involves writing some custom value to some custom manuf. access register twice. Register / value sometimes aren't known at compile time. Consider moving reg info into struct battery_info, then moving board_cut_off_battery() to common.
charger_profile_override_get_param() - Usually empty, don't require definition.
Sure, I can always do code reviews. Any recent Chromebook with TOT EC FW support would be fine for testing (I recommend kevin).
The difficulty of implementing the items in #3 ranges from simple to not so simple.
Comment 1 by chingcodes@chromium.org
, Nov 9 2017