|
@@ -72,7 +72,7 @@ bool pdbs_dpm_evaluate_capability(struct pdb_config *cfg,
|
72
|
72
|
}
|
73
|
73
|
/* If the V from the PDO equals our desired V and the I is at least
|
74
|
74
|
* our desired I */
|
75
|
|
- if (PD_PDO_SRC_FIXED_VOLTAGE_GET(capabilities, i) == scfg->v
|
|
75
|
+ if (PD_PDO_SRC_FIXED_VOLTAGE_GET(capabilities, i) == PD_MV2PDV(scfg->v)
|
76
|
76
|
&& PD_PDO_SRC_FIXED_CURRENT_GET(capabilities, i) >= scfg->i) {
|
77
|
77
|
/* We got what we wanted, so build a request for that */
|
78
|
78
|
request->hdr = cfg->pe.hdr_template | PD_MSGTYPE_REQUEST
|
|
@@ -94,7 +94,7 @@ bool pdbs_dpm_evaluate_capability(struct pdb_config *cfg,
|
94
|
94
|
}
|
95
|
95
|
|
96
|
96
|
/* Update requested voltage */
|
97
|
|
- dpm_data->_requested_voltage = scfg->v;
|
|
97
|
+ dpm_data->_requested_voltage = PD_PDV2MV(PD_MV2PDV(scfg->v));
|
98
|
98
|
|
99
|
99
|
dpm_data->_capability_match = true;
|
100
|
100
|
return true;
|
|
@@ -118,7 +118,7 @@ bool pdbs_dpm_evaluate_capability(struct pdb_config *cfg,
|
118
|
118
|
}
|
119
|
119
|
|
120
|
120
|
/* Update requested voltage */
|
121
|
|
- dpm_data->_requested_voltage = PD_MV2PDV(5000);
|
|
121
|
+ dpm_data->_requested_voltage = 5000;
|
122
|
122
|
|
123
|
123
|
/* At this point, we have a capability match iff the output is disabled */
|
124
|
124
|
dpm_data->_capability_match = !dpm_data->output_enabled;
|
|
@@ -136,7 +136,7 @@ void pdbs_dpm_get_sink_capability(struct pdb_config *cfg, union pd_msg *cap)
|
136
|
136
|
|
137
|
137
|
/* If we have no configuration or want something other than 5 V, add a PDO
|
138
|
138
|
* for vSafe5V */
|
139
|
|
- if (scfg == NULL || scfg->v != PD_MV2PDV(5000)) {
|
|
139
|
+ if (scfg == NULL || PD_MV2PDV(scfg->v) != PD_MV2PDV(5000)) {
|
140
|
140
|
/* Minimum current, 5 V, and higher capability. */
|
141
|
141
|
cap->obj[numobj++] = PD_PDO_TYPE_FIXED
|
142
|
142
|
| PD_PDO_SNK_FIXED_VOLTAGE_SET(PD_MV2PDV(5000))
|
|
@@ -146,10 +146,10 @@ void pdbs_dpm_get_sink_capability(struct pdb_config *cfg, union pd_msg *cap)
|
146
|
146
|
/* Add a PDO for the desired power. */
|
147
|
147
|
if (scfg != NULL) {
|
148
|
148
|
cap->obj[numobj++] = PD_PDO_TYPE_FIXED
|
149
|
|
- | PD_PDO_SNK_FIXED_VOLTAGE_SET(scfg->v)
|
|
149
|
+ | PD_PDO_SNK_FIXED_VOLTAGE_SET(PD_MV2PDV(scfg->v))
|
150
|
150
|
| PD_PDO_SNK_FIXED_CURRENT_SET(scfg->i);
|
151
|
151
|
/* If we want more than 5 V, set the Higher Capability flag */
|
152
|
|
- if (scfg->v != PD_MV2PDV(5000)) {
|
|
152
|
+ if (PD_MV2PDV(scfg->v) != PD_MV2PDV(5000)) {
|
153
|
153
|
cap->obj[0] |= PD_PDO_SNK_FIXED_HIGHER_CAP;
|
154
|
154
|
}
|
155
|
155
|
}
|
|
@@ -184,7 +184,7 @@ bool pdbs_dpm_evaluate_typec_current(struct pdb_config *cfg,
|
184
|
184
|
struct pdbs_dpm_data *dpm_data = cfg->dpm_data;
|
185
|
185
|
|
186
|
186
|
/* We don't control the voltage anymore; it will always be 5 V. */
|
187
|
|
- dpm_data->_requested_voltage = PD_MV2PDV(5000);
|
|
187
|
+ dpm_data->_requested_voltage = 5000;
|
188
|
188
|
|
189
|
189
|
/* Make the present Type-C Current advertisement available to the rest of
|
190
|
190
|
* the DPM */
|
|
@@ -192,7 +192,7 @@ bool pdbs_dpm_evaluate_typec_current(struct pdb_config *cfg,
|
192
|
192
|
|
193
|
193
|
/* If we have no configuration or don't want 5 V, Type-C Current can't
|
194
|
194
|
* possibly satisfy our needs */
|
195
|
|
- if (scfg == NULL || scfg->v != PD_MV2PDV(5000)) {
|
|
195
|
+ if (scfg == NULL || PD_MV2PDV(scfg->v) != PD_MV2PDV(5000)) {
|
196
|
196
|
dpm_data->_capability_match = false;
|
197
|
197
|
return false;
|
198
|
198
|
}
|
|
@@ -256,7 +256,7 @@ void pdbs_dpm_transition_default(struct pdb_config *cfg)
|
256
|
256
|
struct pdbs_dpm_data *dpm_data = cfg->dpm_data;
|
257
|
257
|
|
258
|
258
|
/* Pretend we requested 5 V */
|
259
|
|
- dpm_data->_requested_voltage = PD_MV2PDV(5000);
|
|
259
|
+ dpm_data->_requested_voltage = 5000;
|
260
|
260
|
/* Turn the output off */
|
261
|
261
|
dpm_output_set(cfg->dpm_data, false);
|
262
|
262
|
}
|