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