|
@@ -185,15 +185,16 @@ bool pdb_dpm_giveback_enabled(void)
|
185
|
185
|
return cfg->flags & PDB_CONFIG_FLAGS_GIVEBACK;
|
186
|
186
|
}
|
187
|
187
|
|
188
|
|
-bool pdb_dpm_evaluate_typec_current(void)
|
|
188
|
+bool pdb_dpm_evaluate_typec_current(enum fusb_typec_current tcc)
|
189
|
189
|
{
|
190
|
190
|
struct pdb_config *cfg = pdb_config_flash_read();
|
191
|
191
|
|
192
|
192
|
/* We don't control the voltage anymore; it will always be 5 V. */
|
193
|
193
|
dpm_requested_voltage = PD_MV2PDV(5000);
|
194
|
194
|
|
195
|
|
- /* Get the present Type-C Current advertisement */
|
196
|
|
- pdb_dpm_typec_current = fusb_get_typec_current();
|
|
195
|
+ /* Make the present Type-C Current advertisement available to the rest of
|
|
196
|
+ * the DPM */
|
|
197
|
+ pdb_dpm_typec_current = tcc;
|
197
|
198
|
|
198
|
199
|
/* If we have no configuration or don't want 5 V, Type-C Current can't
|
199
|
200
|
* possibly satisfy our needs */
|
|
@@ -202,11 +203,11 @@ bool pdb_dpm_evaluate_typec_current(void)
|
202
|
203
|
}
|
203
|
204
|
|
204
|
205
|
/* If 1.5 A is available and we want no more than that, great. */
|
205
|
|
- if (pdb_dpm_typec_current == OnePointFiveAmps && cfg->i <= 150) {
|
|
206
|
+ if (tcc == OnePointFiveAmps && cfg->i <= 150) {
|
206
|
207
|
return true;
|
207
|
208
|
}
|
208
|
209
|
/* If 3 A is available and we want no more than that, that's great too. */
|
209
|
|
- if (pdb_dpm_typec_current == ThreePointZeroAmps && cfg->i <= 300) {
|
|
210
|
+ if (tcc == ThreePointZeroAmps && cfg->i <= 300) {
|
210
|
211
|
return true;
|
211
|
212
|
}
|
212
|
213
|
/* We're overly cautious if USB default current is available, since that
|