|
@@ -387,7 +387,7 @@ void pdbs_dpm_pd_start(struct pdb_config *cfg)
|
387
|
387
|
/*
|
388
|
388
|
* Set the output state, with LED indication.
|
389
|
389
|
*/
|
390
|
|
-static void dpm_output_set(struct pdbs_dpm_data *dpm_data, bool state)
|
|
390
|
+static void dpm_output_set(struct pdbs_dpm_data *dpm_data, bool state, bool led)
|
391
|
391
|
{
|
392
|
392
|
/* Update the present voltage */
|
393
|
393
|
dpm_data->_present_voltage = dpm_data->_requested_voltage;
|
|
@@ -395,13 +395,13 @@ static void dpm_output_set(struct pdbs_dpm_data *dpm_data, bool state)
|
395
|
395
|
/* Set the power output */
|
396
|
396
|
if (state && dpm_data->output_enabled) {
|
397
|
397
|
/* Turn the output on */
|
398
|
|
- if (dpm_data->led_pd_status) {
|
|
398
|
+ if (dpm_data->led_pd_status && led) {
|
399
|
399
|
chEvtSignal(pdbs_led_thread, PDBS_EVT_LED_OUTPUT_ON);
|
400
|
400
|
}
|
401
|
401
|
palSetLine(LINE_OUT_CTRL);
|
402
|
402
|
} else {
|
403
|
403
|
/* Turn the output off */
|
404
|
|
- if (dpm_data->led_pd_status) {
|
|
404
|
+ if (dpm_data->led_pd_status && led) {
|
405
|
405
|
chEvtSignal(pdbs_led_thread, PDBS_EVT_LED_OUTPUT_OFF);
|
406
|
406
|
}
|
407
|
407
|
palClearLine(LINE_OUT_CTRL);
|
|
@@ -416,12 +416,12 @@ void pdbs_dpm_transition_default(struct pdb_config *cfg)
|
416
|
416
|
/* Pretend we requested 5 V */
|
417
|
417
|
dpm_data->_requested_voltage = 5000;
|
418
|
418
|
/* Turn the output off */
|
419
|
|
- dpm_output_set(cfg->dpm_data, false);
|
|
419
|
+ dpm_output_set(cfg->dpm_data, false, true);
|
420
|
420
|
}
|
421
|
421
|
|
422
|
422
|
void pdbs_dpm_transition_min(struct pdb_config *cfg)
|
423
|
423
|
{
|
424
|
|
- dpm_output_set(cfg->dpm_data, false);
|
|
424
|
+ dpm_output_set(cfg->dpm_data, false, true);
|
425
|
425
|
}
|
426
|
426
|
|
427
|
427
|
void pdbs_dpm_transition_standby(struct pdb_config *cfg)
|
|
@@ -443,5 +443,21 @@ void pdbs_dpm_transition_requested(struct pdb_config *cfg)
|
443
|
443
|
/* Cast the dpm_data to the right type */
|
444
|
444
|
struct pdbs_dpm_data *dpm_data = cfg->dpm_data;
|
445
|
445
|
|
446
|
|
- dpm_output_set(cfg->dpm_data, dpm_data->_capability_match);
|
|
446
|
+ dpm_output_set(cfg->dpm_data, dpm_data->_capability_match, true);
|
|
447
|
+}
|
|
448
|
+
|
|
449
|
+void pdbs_dpm_transition_typec(struct pdb_config *cfg)
|
|
450
|
+{
|
|
451
|
+ /* Cast the dpm_data to the right type */
|
|
452
|
+ struct pdbs_dpm_data *dpm_data = cfg->dpm_data;
|
|
453
|
+
|
|
454
|
+ /* If we only have default Type-C Current, set a special LED status */
|
|
455
|
+ if (dpm_data->led_pd_status
|
|
456
|
+ && dpm_data->typec_current == fusb_tcc_default) {
|
|
457
|
+ chEvtSignal(pdbs_led_thread, PDBS_EVT_LED_OUTPUT_OFF_NO_TYPEC);
|
|
458
|
+ }
|
|
459
|
+
|
|
460
|
+ /* Set the output, only setting the LED status if it wasn't set above */
|
|
461
|
+ dpm_output_set(cfg->dpm_data, dpm_data->_capability_match,
|
|
462
|
+ dpm_data->typec_current != fusb_tcc_default);
|
447
|
463
|
}
|