at v6.10 20 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Generic OPP Interface 4 * 5 * Copyright (C) 2009-2010 Texas Instruments Incorporated. 6 * Nishanth Menon 7 * Romit Dasgupta 8 * Kevin Hilman 9 */ 10 11#ifndef __LINUX_OPP_H__ 12#define __LINUX_OPP_H__ 13 14#include <linux/energy_model.h> 15#include <linux/err.h> 16#include <linux/notifier.h> 17 18struct clk; 19struct cpufreq_frequency_table; 20struct regulator; 21struct dev_pm_opp; 22struct device; 23struct opp_table; 24 25enum dev_pm_opp_event { 26 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, 27 OPP_EVENT_ADJUST_VOLTAGE, 28}; 29 30/** 31 * struct dev_pm_opp_supply - Power supply voltage/current values 32 * @u_volt: Target voltage in microvolts corresponding to this OPP 33 * @u_volt_min: Minimum voltage in microvolts corresponding to this OPP 34 * @u_volt_max: Maximum voltage in microvolts corresponding to this OPP 35 * @u_amp: Maximum current drawn by the device in microamperes 36 * @u_watt: Power used by the device in microwatts 37 * 38 * This structure stores the voltage/current/power values for a single power 39 * supply. 40 */ 41struct dev_pm_opp_supply { 42 unsigned long u_volt; 43 unsigned long u_volt_min; 44 unsigned long u_volt_max; 45 unsigned long u_amp; 46 unsigned long u_watt; 47}; 48 49typedef int (*config_regulators_t)(struct device *dev, 50 struct dev_pm_opp *old_opp, struct dev_pm_opp *new_opp, 51 struct regulator **regulators, unsigned int count); 52 53typedef int (*config_clks_t)(struct device *dev, struct opp_table *opp_table, 54 struct dev_pm_opp *opp, void *data, bool scaling_down); 55 56/** 57 * struct dev_pm_opp_config - Device OPP configuration values 58 * @clk_names: Clk names, NULL terminated array. 59 * @config_clks: Custom set clk helper. 60 * @prop_name: Name to postfix to properties. 61 * @config_regulators: Custom set regulator helper. 62 * @supported_hw: Array of hierarchy of versions to match. 63 * @supported_hw_count: Number of elements in the array. 64 * @regulator_names: Array of pointers to the names of the regulator, NULL terminated. 65 * @genpd_names: Null terminated array of pointers containing names of genpd to 66 * attach. Mutually exclusive with required_devs. 67 * @virt_devs: Pointer to return the array of genpd virtual devices. Mutually 68 * exclusive with required_devs. 69 * @required_devs: Required OPP devices. Mutually exclusive with genpd_names/virt_devs. 70 * 71 * This structure contains platform specific OPP configurations for the device. 72 */ 73struct dev_pm_opp_config { 74 /* NULL terminated */ 75 const char * const *clk_names; 76 config_clks_t config_clks; 77 const char *prop_name; 78 config_regulators_t config_regulators; 79 const unsigned int *supported_hw; 80 unsigned int supported_hw_count; 81 const char * const *regulator_names; 82 const char * const *genpd_names; 83 struct device ***virt_devs; 84 struct device **required_devs; 85}; 86 87#define OPP_LEVEL_UNSET U32_MAX 88 89/** 90 * struct dev_pm_opp_data - The data to use to initialize an OPP. 91 * @turbo: Flag to indicate whether the OPP is to be marked turbo or not. 92 * @level: The performance level for the OPP. Set level to OPP_LEVEL_UNSET if 93 * level field isn't used. 94 * @freq: The clock rate in Hz for the OPP. 95 * @u_volt: The voltage in uV for the OPP. 96 */ 97struct dev_pm_opp_data { 98 bool turbo; 99 unsigned int level; 100 unsigned long freq; 101 unsigned long u_volt; 102}; 103 104#if defined(CONFIG_PM_OPP) 105 106struct opp_table *dev_pm_opp_get_opp_table(struct device *dev); 107void dev_pm_opp_put_opp_table(struct opp_table *opp_table); 108 109unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp); 110 111int dev_pm_opp_get_supplies(struct dev_pm_opp *opp, struct dev_pm_opp_supply *supplies); 112 113unsigned long dev_pm_opp_get_power(struct dev_pm_opp *opp); 114 115unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp *opp, u32 index); 116 117unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp); 118 119unsigned int dev_pm_opp_get_required_pstate(struct dev_pm_opp *opp, 120 unsigned int index); 121 122bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp); 123 124int dev_pm_opp_get_opp_count(struct device *dev); 125unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev); 126unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev); 127unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev); 128unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev); 129 130struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, 131 unsigned long freq, 132 bool available); 133 134struct dev_pm_opp * 135dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, 136 u32 index, bool available); 137 138struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, 139 unsigned long *freq); 140 141struct dev_pm_opp *dev_pm_opp_find_freq_floor_indexed(struct device *dev, 142 unsigned long *freq, u32 index); 143 144struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, 145 unsigned long *freq); 146 147struct dev_pm_opp *dev_pm_opp_find_freq_ceil_indexed(struct device *dev, 148 unsigned long *freq, u32 index); 149 150struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, 151 unsigned int level); 152 153struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, 154 unsigned int *level); 155 156struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, 157 unsigned int *level); 158 159struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, 160 unsigned int *bw, int index); 161 162struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, 163 unsigned int *bw, int index); 164 165void dev_pm_opp_put(struct dev_pm_opp *opp); 166 167int dev_pm_opp_add_dynamic(struct device *dev, struct dev_pm_opp_data *opp); 168 169void dev_pm_opp_remove(struct device *dev, unsigned long freq); 170void dev_pm_opp_remove_all_dynamic(struct device *dev); 171 172int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, 173 unsigned long u_volt, unsigned long u_volt_min, 174 unsigned long u_volt_max); 175 176int dev_pm_opp_enable(struct device *dev, unsigned long freq); 177 178int dev_pm_opp_disable(struct device *dev, unsigned long freq); 179 180int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb); 181int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb); 182 183int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); 184int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); 185void dev_pm_opp_clear_config(int token); 186int dev_pm_opp_config_clks_simple(struct device *dev, 187 struct opp_table *opp_table, struct dev_pm_opp *opp, void *data, 188 bool scaling_down); 189 190struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_table *src_table, struct opp_table *dst_table, struct dev_pm_opp *src_opp); 191int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); 192int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); 193int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp); 194int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); 195int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); 196void dev_pm_opp_remove_table(struct device *dev); 197void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask); 198int dev_pm_opp_sync_regulators(struct device *dev); 199#else 200static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev) 201{ 202 return ERR_PTR(-EOPNOTSUPP); 203} 204 205static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index) 206{ 207 return ERR_PTR(-EOPNOTSUPP); 208} 209 210static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {} 211 212static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) 213{ 214 return 0; 215} 216 217static inline int dev_pm_opp_get_supplies(struct dev_pm_opp *opp, struct dev_pm_opp_supply *supplies) 218{ 219 return -EOPNOTSUPP; 220} 221 222static inline unsigned long dev_pm_opp_get_power(struct dev_pm_opp *opp) 223{ 224 return 0; 225} 226 227static inline unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp *opp, u32 index) 228{ 229 return 0; 230} 231 232static inline unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp) 233{ 234 return 0; 235} 236 237static inline 238unsigned int dev_pm_opp_get_required_pstate(struct dev_pm_opp *opp, 239 unsigned int index) 240{ 241 return 0; 242} 243 244static inline bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp) 245{ 246 return false; 247} 248 249static inline int dev_pm_opp_get_opp_count(struct device *dev) 250{ 251 return 0; 252} 253 254static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev) 255{ 256 return 0; 257} 258 259static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) 260{ 261 return 0; 262} 263 264static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev) 265{ 266 return 0; 267} 268 269static inline unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev) 270{ 271 return 0; 272} 273 274static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, 275 unsigned long freq, bool available) 276{ 277 return ERR_PTR(-EOPNOTSUPP); 278} 279 280static inline struct dev_pm_opp * 281dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, 282 u32 index, bool available) 283{ 284 return ERR_PTR(-EOPNOTSUPP); 285} 286 287static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, 288 unsigned long *freq) 289{ 290 return ERR_PTR(-EOPNOTSUPP); 291} 292 293static inline struct dev_pm_opp * 294dev_pm_opp_find_freq_floor_indexed(struct device *dev, unsigned long *freq, u32 index) 295{ 296 return ERR_PTR(-EOPNOTSUPP); 297} 298 299static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, 300 unsigned long *freq) 301{ 302 return ERR_PTR(-EOPNOTSUPP); 303} 304 305static inline struct dev_pm_opp * 306dev_pm_opp_find_freq_ceil_indexed(struct device *dev, unsigned long *freq, u32 index) 307{ 308 return ERR_PTR(-EOPNOTSUPP); 309} 310 311static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, 312 unsigned int level) 313{ 314 return ERR_PTR(-EOPNOTSUPP); 315} 316 317static inline struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, 318 unsigned int *level) 319{ 320 return ERR_PTR(-EOPNOTSUPP); 321} 322 323static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, 324 unsigned int *level) 325{ 326 return ERR_PTR(-EOPNOTSUPP); 327} 328 329static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, 330 unsigned int *bw, int index) 331{ 332 return ERR_PTR(-EOPNOTSUPP); 333} 334 335static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, 336 unsigned int *bw, int index) 337{ 338 return ERR_PTR(-EOPNOTSUPP); 339} 340 341static inline void dev_pm_opp_put(struct dev_pm_opp *opp) {} 342 343static inline int 344dev_pm_opp_add_dynamic(struct device *dev, struct dev_pm_opp_data *opp) 345{ 346 return -EOPNOTSUPP; 347} 348 349static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq) 350{ 351} 352 353static inline void dev_pm_opp_remove_all_dynamic(struct device *dev) 354{ 355} 356 357static inline int 358dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, 359 unsigned long u_volt, unsigned long u_volt_min, 360 unsigned long u_volt_max) 361{ 362 return 0; 363} 364 365static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) 366{ 367 return 0; 368} 369 370static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq) 371{ 372 return 0; 373} 374 375static inline int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb) 376{ 377 return -EOPNOTSUPP; 378} 379 380static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb) 381{ 382 return -EOPNOTSUPP; 383} 384 385static inline int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) 386{ 387 return -EOPNOTSUPP; 388} 389 390static inline int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) 391{ 392 return -EOPNOTSUPP; 393} 394 395static inline void dev_pm_opp_clear_config(int token) {} 396 397static inline int dev_pm_opp_config_clks_simple(struct device *dev, 398 struct opp_table *opp_table, struct dev_pm_opp *opp, void *data, 399 bool scaling_down) 400{ 401 return -EOPNOTSUPP; 402} 403 404static inline struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_table *src_table, 405 struct opp_table *dst_table, struct dev_pm_opp *src_opp) 406{ 407 return ERR_PTR(-EOPNOTSUPP); 408} 409 410static inline int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate) 411{ 412 return -EOPNOTSUPP; 413} 414 415static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) 416{ 417 return -EOPNOTSUPP; 418} 419 420static inline int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp) 421{ 422 return -EOPNOTSUPP; 423} 424 425static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask) 426{ 427 return -EOPNOTSUPP; 428} 429 430static inline int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) 431{ 432 return -EINVAL; 433} 434 435static inline void dev_pm_opp_remove_table(struct device *dev) 436{ 437} 438 439static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask) 440{ 441} 442 443static inline int dev_pm_opp_sync_regulators(struct device *dev) 444{ 445 return -EOPNOTSUPP; 446} 447 448#endif /* CONFIG_PM_OPP */ 449 450#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) 451int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table); 452void dev_pm_opp_free_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table); 453#else 454static inline int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table) 455{ 456 return -EINVAL; 457} 458 459static inline void dev_pm_opp_free_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table) 460{ 461} 462#endif 463 464 465#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) 466int dev_pm_opp_of_add_table(struct device *dev); 467int dev_pm_opp_of_add_table_indexed(struct device *dev, int index); 468int devm_pm_opp_of_add_table_indexed(struct device *dev, int index); 469void dev_pm_opp_of_remove_table(struct device *dev); 470int devm_pm_opp_of_add_table(struct device *dev); 471int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); 472void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); 473int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); 474struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); 475struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); 476int of_get_required_opp_performance_state(struct device_node *np, int index); 477int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table); 478int dev_pm_opp_of_register_em(struct device *dev, struct cpumask *cpus); 479int dev_pm_opp_calc_power(struct device *dev, unsigned long *uW, 480 unsigned long *kHz); 481static inline void dev_pm_opp_of_unregister_em(struct device *dev) 482{ 483 em_dev_unregister_perf_domain(dev); 484} 485#else 486static inline int dev_pm_opp_of_add_table(struct device *dev) 487{ 488 return -EOPNOTSUPP; 489} 490 491static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) 492{ 493 return -EOPNOTSUPP; 494} 495 496static inline int devm_pm_opp_of_add_table_indexed(struct device *dev, int index) 497{ 498 return -EOPNOTSUPP; 499} 500 501static inline void dev_pm_opp_of_remove_table(struct device *dev) 502{ 503} 504 505static inline int devm_pm_opp_of_add_table(struct device *dev) 506{ 507 return -EOPNOTSUPP; 508} 509 510static inline int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask) 511{ 512 return -EOPNOTSUPP; 513} 514 515static inline void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask) 516{ 517} 518 519static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) 520{ 521 return -EOPNOTSUPP; 522} 523 524static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) 525{ 526 return NULL; 527} 528 529static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) 530{ 531 return NULL; 532} 533 534static inline int dev_pm_opp_of_register_em(struct device *dev, 535 struct cpumask *cpus) 536{ 537 return -EOPNOTSUPP; 538} 539 540static inline void dev_pm_opp_of_unregister_em(struct device *dev) 541{ 542} 543 544static inline int dev_pm_opp_calc_power(struct device *dev, unsigned long *uW, 545 unsigned long *kHz) 546{ 547 return -EOPNOTSUPP; 548} 549 550static inline int of_get_required_opp_performance_state(struct device_node *np, int index) 551{ 552 return -EOPNOTSUPP; 553} 554 555static inline int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table) 556{ 557 return -EOPNOTSUPP; 558} 559#endif 560 561/* OPP Configuration helpers */ 562 563static inline int dev_pm_opp_add(struct device *dev, unsigned long freq, 564 unsigned long u_volt) 565{ 566 struct dev_pm_opp_data data = { 567 .freq = freq, 568 .u_volt = u_volt, 569 }; 570 571 return dev_pm_opp_add_dynamic(dev, &data); 572} 573 574/* Regulators helpers */ 575static inline int dev_pm_opp_set_regulators(struct device *dev, 576 const char * const names[]) 577{ 578 struct dev_pm_opp_config config = { 579 .regulator_names = names, 580 }; 581 582 return dev_pm_opp_set_config(dev, &config); 583} 584 585static inline void dev_pm_opp_put_regulators(int token) 586{ 587 dev_pm_opp_clear_config(token); 588} 589 590static inline int devm_pm_opp_set_regulators(struct device *dev, 591 const char * const names[]) 592{ 593 struct dev_pm_opp_config config = { 594 .regulator_names = names, 595 }; 596 597 return devm_pm_opp_set_config(dev, &config); 598} 599 600/* Supported-hw helpers */ 601static inline int dev_pm_opp_set_supported_hw(struct device *dev, 602 const u32 *versions, 603 unsigned int count) 604{ 605 struct dev_pm_opp_config config = { 606 .supported_hw = versions, 607 .supported_hw_count = count, 608 }; 609 610 return dev_pm_opp_set_config(dev, &config); 611} 612 613static inline void dev_pm_opp_put_supported_hw(int token) 614{ 615 dev_pm_opp_clear_config(token); 616} 617 618static inline int devm_pm_opp_set_supported_hw(struct device *dev, 619 const u32 *versions, 620 unsigned int count) 621{ 622 struct dev_pm_opp_config config = { 623 .supported_hw = versions, 624 .supported_hw_count = count, 625 }; 626 627 return devm_pm_opp_set_config(dev, &config); 628} 629 630/* clkname helpers */ 631static inline int dev_pm_opp_set_clkname(struct device *dev, const char *name) 632{ 633 const char *names[] = { name, NULL }; 634 struct dev_pm_opp_config config = { 635 .clk_names = names, 636 }; 637 638 return dev_pm_opp_set_config(dev, &config); 639} 640 641static inline void dev_pm_opp_put_clkname(int token) 642{ 643 dev_pm_opp_clear_config(token); 644} 645 646static inline int devm_pm_opp_set_clkname(struct device *dev, const char *name) 647{ 648 const char *names[] = { name, NULL }; 649 struct dev_pm_opp_config config = { 650 .clk_names = names, 651 }; 652 653 return devm_pm_opp_set_config(dev, &config); 654} 655 656/* config-regulators helpers */ 657static inline int dev_pm_opp_set_config_regulators(struct device *dev, 658 config_regulators_t helper) 659{ 660 struct dev_pm_opp_config config = { 661 .config_regulators = helper, 662 }; 663 664 return dev_pm_opp_set_config(dev, &config); 665} 666 667static inline void dev_pm_opp_put_config_regulators(int token) 668{ 669 dev_pm_opp_clear_config(token); 670} 671 672/* genpd helpers */ 673static inline int dev_pm_opp_attach_genpd(struct device *dev, 674 const char * const *names, 675 struct device ***virt_devs) 676{ 677 struct dev_pm_opp_config config = { 678 .genpd_names = names, 679 .virt_devs = virt_devs, 680 }; 681 682 return dev_pm_opp_set_config(dev, &config); 683} 684 685static inline void dev_pm_opp_detach_genpd(int token) 686{ 687 dev_pm_opp_clear_config(token); 688} 689 690static inline int devm_pm_opp_attach_genpd(struct device *dev, 691 const char * const *names, 692 struct device ***virt_devs) 693{ 694 struct dev_pm_opp_config config = { 695 .genpd_names = names, 696 .virt_devs = virt_devs, 697 }; 698 699 return devm_pm_opp_set_config(dev, &config); 700} 701 702/* prop-name helpers */ 703static inline int dev_pm_opp_set_prop_name(struct device *dev, const char *name) 704{ 705 struct dev_pm_opp_config config = { 706 .prop_name = name, 707 }; 708 709 return dev_pm_opp_set_config(dev, &config); 710} 711 712static inline void dev_pm_opp_put_prop_name(int token) 713{ 714 dev_pm_opp_clear_config(token); 715} 716 717static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) 718{ 719 return dev_pm_opp_get_freq_indexed(opp, 0); 720} 721 722#endif /* __LINUX_OPP_H__ */