devm_pm_opp_of_add_table(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devm_pm_opp_of_add_table πŸ’…

okay bestie, welcome to the Kernel API Manual β€” this one's all about booting up your OPP table straight from the device tree, and it's honestly kind of iconic. it's devm_pm_opp_of_add_table, and yes the devm_ prefix is doing exactly what you think it's doing (auto-cleanup, we love a self-cleaning king πŸ‘‘).


✨ NAME ✨

devm_pm_opp_of_add_table β€” initialize opp table from device tree


πŸ¦‹ SYNOPSIS πŸ¦‹

int devm_pm_opp_of_add_table (struct device *dev );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” device pointer used to lookup OPP table. that's it, that's the whole arg bestie πŸ’…

🌸 DESCRIPTION 🌸

so basically this registers the initial OPP table with the OPP library for whatever device you handed it. that's the vibe check βœ…

and here's the lowkey best part: the opp_table structure will be freed after the device is destroyed. no cap, the devm machinery handles the cleanup for you so you don't have to think about it β€” main character energy fr fr 🫢


πŸ”₯ RETURN πŸ”₯

here's where it gets real, so pay attention:

  • 0 β€” on success OR duplicate OPPs (both freq and volt are same) and opp->available
  • -EEXIST β€” freq are same and volt are different OR duplicate OPPs (both freq and volt are same) and !opp->available
  • -ENOMEM β€” memory allocation failure 😭
  • -ENODEV β€” when 'operating-points' property is not found or is invalid data in device node
  • -ENODATA β€” when empty 'operating-points' property is found
  • -EINVAL β€” when invalid entries are found in opp-v2 table
ngl the 0 case being "success OR duplicate OPPs" is a whole mood β€” it's giving "if it's already there, we're fine, moving on" πŸ’€

🧚 SEE ALSO 🧚

kernel file ./drivers/opp/of.c, plus these legends:


and that's the whole page, bestie!! go forth and register those OPP tables πŸ’–βœ¨

this has been brought to you by ./drivers/opp, dated October 2026, from the Kernel API Manual β€” stay slay, stay devm'd πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from