Browse Source

Added DPM function to get GiveBack flag

Clara Hobbs 5 years ago
parent
commit
99421b50bd
2 changed files with 12 additions and 0 deletions
  1. 7
    0
      src/device_policy_manager.c
  2. 5
    0
      src/device_policy_manager.h

+ 7
- 0
src/device_policy_manager.c View File

@@ -128,6 +128,13 @@ void pdb_dpm_get_sink_capability(union pd_msg *cap)
128 128
         | PD_POWERROLE_SINK | PD_NUMOBJ(numobj);
129 129
 }
130 130
 
131
+bool pdb_dpm_giveback_enabled(void)
132
+{
133
+    struct pdb_config *cfg = pdb_config_flash_read();
134
+
135
+    return cfg->flags & PDB_CONFIG_FLAGS_GIVEBACK;
136
+}
137
+
131 138
 bool pdb_dpm_evaluate_typec_current(void)
132 139
 {
133 140
     static bool cfg_set = false;

+ 5
- 0
src/device_policy_manager.h View File

@@ -36,6 +36,11 @@ bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg
36 36
  */
37 37
 void pdb_dpm_get_sink_capability(union pd_msg *cap);
38 38
 
39
+/*
40
+ * Return whether or not GiveBack support is enabled.
41
+ */
42
+bool pdb_dpm_giveback_enabled(void);
43
+
39 44
 /*
40 45
  * Evaluate whether or not the currently offered Type-C Current can fulfill our
41 46
  * power needs.

Loading…
Cancel
Save