|
@@ -25,7 +25,6 @@
|
25
|
25
|
#include "led.h"
|
26
|
26
|
#include "storage.h"
|
27
|
27
|
#include "pd.h"
|
28
|
|
-#include "fusb302b.h"
|
29
|
28
|
|
30
|
29
|
|
31
|
30
|
bool pdb_dpm_output_enabled = true;
|
|
@@ -33,6 +32,7 @@ bool pdb_dpm_led_pd_status = true;
|
33
|
32
|
bool pdb_dpm_usb_comms = false;
|
34
|
33
|
|
35
|
34
|
const union pd_msg *pdb_dpm_capabilities = NULL;
|
|
35
|
+enum fusb_typec_current pdb_dpm_typec_current = None;
|
36
|
36
|
|
37
|
37
|
|
38
|
38
|
/* The current draw when the output is disabled */
|
|
@@ -200,21 +200,21 @@ bool pdb_dpm_evaluate_typec_current(void)
|
200
|
200
|
/* We don't control the voltage anymore; it will always be 5 V. */
|
201
|
201
|
dpm_requested_voltage = PD_MV2PDV(5000);
|
202
|
202
|
|
|
203
|
+ /* Get the present Type-C Current advertisement */
|
|
204
|
+ pdb_dpm_typec_current = fusb_get_typec_current();
|
|
205
|
+
|
203
|
206
|
/* If we have no configuration or don't want 5 V, Type-C Current can't
|
204
|
207
|
* possibly satisfy our needs */
|
205
|
208
|
if (cfg == NULL || cfg->v != PD_MV2PDV(5000)) {
|
206
|
209
|
return false;
|
207
|
210
|
}
|
208
|
211
|
|
209
|
|
- /* Get the present Type-C Current advertisement */
|
210
|
|
- enum fusb_typec_current tcc = fusb_get_typec_current();
|
211
|
|
-
|
212
|
212
|
/* If 1.5 A is available and we want no more than that, great. */
|
213
|
|
- if (tcc == OnePointFiveAmps && cfg->i <= 150) {
|
|
213
|
+ if (pdb_dpm_typec_current == OnePointFiveAmps && cfg->i <= 150) {
|
214
|
214
|
return true;
|
215
|
215
|
}
|
216
|
216
|
/* If 3 A is available and we want no more than that, that's great too. */
|
217
|
|
- if (tcc == ThreePointZeroAmps && cfg->i <= 300) {
|
|
217
|
+ if (pdb_dpm_typec_current == ThreePointZeroAmps && cfg->i <= 300) {
|
218
|
218
|
return true;
|
219
|
219
|
}
|
220
|
220
|
/* We're overly cautious if USB default current is available, since that
|