MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_regulator_disable

Function rt_regulator_disable

components/drivers/regulator/regulator.c:306–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306rt_err_t rt_regulator_disable(struct rt_regulator *reg)
307{
308 rt_err_t err;
309
310 if (!reg)
311 {
312 return -RT_EINVAL;
313 }
314
315 if (!rt_regulator_is_enabled(reg))
316 {
317 return RT_EOK;
318 }
319
320 if (rt_atomic_load(&reg->reg_np->enabled_count) != 0)
321 {
322 rt_atomic_sub(&reg->reg_np->enabled_count, 1);
323
324 return RT_EOK;
325 }
326
327 rt_hw_spin_lock(&_regulator_lock.lock);
328
329 err = regulator_disable(reg->reg_np);
330
331 rt_hw_spin_unlock(&_regulator_lock.lock);
332
333 return err;
334}
335
336rt_bool_t rt_regulator_is_enabled(struct rt_regulator *reg)
337{

Callers 1

pwm_fan_power_offFunction · 0.85

Calls 4

rt_regulator_is_enabledFunction · 0.85
regulator_disableFunction · 0.70
rt_hw_spin_lockFunction · 0.50
rt_hw_spin_unlockFunction · 0.50

Tested by

no test coverage detected