Skip to content

Commit e4deb46

Browse files
decsnydleach02
authored andcommitted
dts: nxp_vref: Add current compensation prop
Add DT property to enable current compensation feature of NXP VREF. Signed-off-by: Declan Snyder <[email protected]>
1 parent 7f4c948 commit e4deb46

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/regulator/regulator_nxp_vref.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct regulator_nxp_vref_config {
2626
VREF_Type *base;
2727
uint16_t buf_start_delay;
2828
uint16_t bg_start_time;
29+
bool current_compensation_en;
2930
};
3031

3132
static int regulator_nxp_vref_enable(const struct device *dev)
@@ -183,6 +184,8 @@ static const struct regulator_driver_api api = {
183184

184185
static int regulator_nxp_vref_init(const struct device *dev)
185186
{
187+
const struct regulator_nxp_vref_config *config = dev->config;
188+
VREF_Type *const base = config->base;
186189
int ret;
187190

188191
regulator_common_data_init(dev);
@@ -192,6 +195,10 @@ static int regulator_nxp_vref_init(const struct device *dev)
192195
return ret;
193196
}
194197

198+
if (config->current_compensation_en) {
199+
base->CSR |= VREF_CSR_ICOMPEN_MASK;
200+
}
201+
195202
return regulator_common_init(dev, false);
196203
}
197204

@@ -205,6 +212,8 @@ static int regulator_nxp_vref_init(const struct device *dev)
205212
nxp_buffer_startup_delay_us), \
206213
.bg_start_time = DT_INST_PROP(inst, \
207214
nxp_bandgap_startup_time_us), \
215+
.current_compensation_en = DT_INST_PROP(inst, \
216+
nxp_current_compensation_en), \
208217
}; \
209218
\
210219
DEVICE_DT_INST_DEFINE(inst, regulator_nxp_vref_init, NULL, &data_##inst,\

dts/bindings/regulator/nxp,vref.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ properties:
3434
Maximum bandgap startup time as specified in the
3535
appropriate device data sheet, in microseconds.
3636
37+
nxp,current-compensation-en:
38+
type: boolean
39+
description: |
40+
Enable second-order curvature compensation.
41+
This must be enabled to achieve the performance stated in the datasheet.
42+
However, the reset value of the peripheral has it disabled.
43+
3744
"#nxp,reference-cells":
3845
type: int
3946
const: 1

0 commit comments

Comments
 (0)