Lina Iyer | a6cc648 | 2017-05-02 20:59:55 -0600 | [diff] [blame] | 1 | /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #ifndef __SOC_QCOM_RPMH_H__ |
| 14 | #define __SOC_QCOM_RPMH_H__ |
| 15 | |
| 16 | #include <soc/qcom/tcs.h> |
David Dai | 9d66f3f | 2016-11-23 15:33:06 -0800 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 18 | |
| 19 | struct rpmh_client; |
| 20 | |
| 21 | #ifdef CONFIG_QTI_RPMH_API |
| 22 | int rpmh_write_single(struct rpmh_client *rc, enum rpmh_state state, |
| 23 | u32 addr, u32 data); |
| 24 | |
| 25 | int rpmh_write_single_async(struct rpmh_client *rc, |
| 26 | enum rpmh_state state, u32 addr, u32 data); |
| 27 | |
| 28 | int rpmh_write(struct rpmh_client *rc, enum rpmh_state state, |
| 29 | struct tcs_cmd *cmd, int n); |
| 30 | |
| 31 | int rpmh_write_async(struct rpmh_client *rc, enum rpmh_state state, |
| 32 | struct tcs_cmd *cmd, int n); |
| 33 | |
| 34 | int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state, |
| 35 | struct tcs_cmd *cmd, int *n); |
| 36 | |
Lina Iyer | a6cc648 | 2017-05-02 20:59:55 -0600 | [diff] [blame] | 37 | int rpmh_mode_solver_set(struct rpmh_client *rc, bool enable); |
| 38 | |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 39 | int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n); |
| 40 | |
| 41 | int rpmh_invalidate(struct rpmh_client *rc); |
| 42 | |
Lina Iyer | 4a8655f | 2017-08-15 11:30:08 -0600 | [diff] [blame] | 43 | int rpmh_ctrlr_idle(struct rpmh_client *rc); |
| 44 | |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 45 | int rpmh_flush(struct rpmh_client *rc); |
| 46 | |
| 47 | int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp); |
| 48 | |
| 49 | struct rpmh_client *rpmh_get_byname(struct platform_device *pdev, |
| 50 | const char *name); |
| 51 | |
| 52 | struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev, |
| 53 | int index); |
| 54 | |
| 55 | void rpmh_release(struct rpmh_client *rc); |
| 56 | #else |
| 57 | static inline int rpmh_write_single(struct rpmh_client *rc, |
| 58 | enum rpmh_state state, u32 addr, u32 data) |
| 59 | { return -ENODEV; } |
| 60 | |
| 61 | static inline int rpmh_write_single_async(struct rpmh_client *rc, |
| 62 | enum rpmh_state state, u32 addr, u32 data) |
| 63 | { return -ENODEV; } |
| 64 | |
| 65 | static inline int rpmh_write(struct rpmh_client *rc, enum rpmh_state state, |
| 66 | struct tcs_cmd *cmd, int n) |
| 67 | { return -ENODEV; } |
| 68 | |
| 69 | static inline int rpmh_write_async(struct rpmh_client *rc, |
| 70 | enum rpmh_state state, struct tcs_cmd *cmd, int n) |
| 71 | { return -ENODEV; } |
| 72 | |
| 73 | static inline int rpmh_write_passthru(struct rpmh_client *rc, |
| 74 | enum rpmh_state state, struct tcs_cmd *cmd, int *n) |
| 75 | { return -ENODEV; } |
| 76 | |
Lina Iyer | a6cc648 | 2017-05-02 20:59:55 -0600 | [diff] [blame] | 77 | static inline int rpmh_mode_solver_set(struct rpmh_client *rc, bool enable) |
| 78 | { return -ENODEV; } |
| 79 | |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 80 | static inline int rpmh_write_control(struct rpmh_client *rc, |
| 81 | struct tcs_cmd *cmd, int n) |
| 82 | { return -ENODEV; } |
| 83 | |
| 84 | static inline int rpmh_invalidate(struct rpmh_client *rc) |
| 85 | { return -ENODEV; } |
| 86 | |
Lina Iyer | 4a8655f | 2017-08-15 11:30:08 -0600 | [diff] [blame] | 87 | static inline int rpmh_ctrlr_idle(struct rpmh_client *rc) |
| 88 | { return -ENODEV; } |
| 89 | |
Lina Iyer | d7194ff | 2016-04-20 17:13:34 -0600 | [diff] [blame] | 90 | static inline int rpmh_flush(struct rpmh_client *rc) |
| 91 | { return -ENODEV; } |
| 92 | |
| 93 | static inline int rpmh_read(struct rpmh_client *rc, u32 addr, |
| 94 | u32 *resp) |
| 95 | { return -ENODEV; } |
| 96 | |
| 97 | static inline struct rpmh_client *rpmh_get_byname(struct platform_device *pdev, |
| 98 | const char *name) |
| 99 | { return ERR_PTR(-ENODEV); } |
| 100 | |
| 101 | static inline struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev, |
| 102 | int index) |
| 103 | { return ERR_PTR(-ENODEV); } |
| 104 | |
| 105 | static inline void rpmh_release(struct rpmh_client *rc) { } |
| 106 | #endif /* CONFIG_QTI_RPMH_API */ |
| 107 | |
| 108 | #endif /* __SOC_QCOM_RPMH_H__ */ |