regulator_get(9)
π regulator_get(9) β like, the whole kernel API manual, but make it make sense
okay bestie, so this is a page from the Kernel API Manual, and it's about regulator_get(9). Yes, that's a real function name, no I'm not kidding, and yes it's lowkey important. Sit down, hydrate, let's go π«Ά
β¨ NAME β¨
regulator_get β lookup and obtain a reference to a regulator. That's it, that's the vibe. You're getting a handle on a regulator, fr fr.
π¦ SYNOPSIS π¦
struct regulator * regulator_get (struct device *dev , const char *id );
like, you hand it a device and an id and it hands you back a struct regulator * pointer. iconic behavior honestly.
π ARGUMENTS π
devβ the device that's playing the "consumer" role for this regulator π§ like, the one who's gonna use the power.idβ the supply name or the regulator ID. this is how you tell it which one you want, iykyk.
π DESCRIPTION π
okay so here's the tea β β using supply names that you set up through set_consumer_device_supply is strongly encouraged. like, that's the recommended path, no cap.
and the rec is this: the supply name you use should match the name used for the supply and/or the relevant device pins in the datasheet. yes, the datasheet. yes, you have to open it. I know. π it's giving homework but it's also giving correct hardware behavior so.
π RETURN π
so what do you get back? either:
- a pointer to a
struct regulatorthat corresponds to the regulator producer π (slay), or - an
ERR_PTRencoded negative error number π (not slay, check it withIS_ERR()in your head, bestie β well, the page says it'sERR_PTRencoded, that's the fact, I'm just being dramatic)
β οΈ real talk: that error is encoded inside the pointer, so please don't just do if (!ptr) and call it a day. that's not a null check situation. π
π₯ SEE ALSO π₯
this list is long and I respect it deeply. Kernel file ./drivers/regulator/core.c plus:
regulator_lock_nested(9), regulator_lock(9), regulator_unlock(9), regulator_lock_two(9), regulator_unlock_two(9), regulator_unlock_dependent(9), regulator_lock_dependent(9), set_machine_constraints(9), regulator_event_work_fn(9), regulator_event_forward_notifier(9), register_regulator_event_forwarding(9), set_supply(9), set_consumer_device_supply(9), regulator_dev_lookup(9), _regulator_get_common(9), regulator_get_exclusive(9), regulator_get_optional(9), regulator_put(9), regulator_register_supply_alias(9), regulator_unregister_supply_alias(9), regulator_bulk_register_supply_alias(9), regulator_bulk_unregister_supply_alias(9), regulator_ena_gpio_ctrl(9), _regulator_check_status_enabled(9), _regulator_handle_consumer_enable(9), _regulator_handle_consumer_disable(9), regulator_enable(9), regulator_disable(9), regulator_force_disable(9), regulator_disable_deferred(9), regulator_is_enabled(9), regulator_count_voltages(9), regulator_list_voltage(9), regulator_get_regmap(9), regulator_get_hardware_vsel_register(9), regulator_list_hardware_vsel(9), regulator_hardware_enable(9), regulator_get_linear_step(9), regulator_is_supported_voltage(9), regulator_set_voltage(9), regulator_set_voltage_time(9), regulator_set_voltage_time_sel(9), regulator_sync_voltage(9), regulator_get_voltage(9), regulator_set_current_limit(9), regulator_get_current_limit(9), regulator_get_unclaimed_power_budget(9), regulator_request_power_budget(9), regulator_free_power_budget(9), regulator_set_mode(9), regulator_get_mode(9), regulator_get_error_flags(9), regulator_set_load(9), regulator_allow_bypass(9), regulator_register_notifier(9), regulator_unregister_notifier(9), regulator_bulk_get(9), regulator_bulk_enable(9), regulator_bulk_disable(9), regulator_bulk_force_disable(9), regulator_bulk_free(9), regulator_handle_critical(9), regulator_notifier_call_chain(9), regulator_mode_to_status(9), regulator_register(9), regulator_unregister(9), regulator_suspend(9), regulator_has_full_constraints(9), rdev_get_drvdata(9), regulator_get_drvdata(9), regulator_set_drvdata(9), rdev_get_id(9)
likeβ¦ go read some of those. pick a fave. they're all in ./drivers/regulator/core.c and they all have main character energy in their own way π
and that's the page!! mwah π this was the Kernel API Manual, brought to you from ./drivers/regulator, dated October 2026 β go forth and regulator_get responsibly, bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms