blob: f0b3d02fe1b1f4db6fdfdbca8cac5f8bb9be097e [file] [log] [blame]
Lina Iyera6cc6482017-05-02 20:59:55 -06001/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
Lina Iyerd7194ff2016-04-20 17:13:34 -06002 *
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 Dai9d66f3f2016-11-23 15:33:06 -080017#include <linux/platform_device.h>
Lina Iyerd7194ff2016-04-20 17:13:34 -060018
19struct rpmh_client;
20
21#ifdef CONFIG_QTI_RPMH_API
22int rpmh_write_single(struct rpmh_client *rc, enum rpmh_state state,
23 u32 addr, u32 data);
24
25int rpmh_write_single_async(struct rpmh_client *rc,
26 enum rpmh_state state, u32 addr, u32 data);
27
28int rpmh_write(struct rpmh_client *rc, enum rpmh_state state,
29 struct tcs_cmd *cmd, int n);
30
31int rpmh_write_async(struct rpmh_client *rc, enum rpmh_state state,
32 struct tcs_cmd *cmd, int n);
33
34int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
35 struct tcs_cmd *cmd, int *n);
36
Lina Iyera6cc6482017-05-02 20:59:55 -060037int rpmh_mode_solver_set(struct rpmh_client *rc, bool enable);
38
Lina Iyerd7194ff2016-04-20 17:13:34 -060039int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n);
40
41int rpmh_invalidate(struct rpmh_client *rc);
42
Lina Iyer4a8655f2017-08-15 11:30:08 -060043int rpmh_ctrlr_idle(struct rpmh_client *rc);
44
Lina Iyerd7194ff2016-04-20 17:13:34 -060045int rpmh_flush(struct rpmh_client *rc);
46
47int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp);
48
49struct rpmh_client *rpmh_get_byname(struct platform_device *pdev,
50 const char *name);
51
52struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev,
53 int index);
54
55void rpmh_release(struct rpmh_client *rc);
56#else
57static inline int rpmh_write_single(struct rpmh_client *rc,
58 enum rpmh_state state, u32 addr, u32 data)
59{ return -ENODEV; }
60
61static inline int rpmh_write_single_async(struct rpmh_client *rc,
62 enum rpmh_state state, u32 addr, u32 data)
63{ return -ENODEV; }
64
65static inline int rpmh_write(struct rpmh_client *rc, enum rpmh_state state,
66 struct tcs_cmd *cmd, int n)
67{ return -ENODEV; }
68
69static inline int rpmh_write_async(struct rpmh_client *rc,
70 enum rpmh_state state, struct tcs_cmd *cmd, int n)
71{ return -ENODEV; }
72
73static 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 Iyera6cc6482017-05-02 20:59:55 -060077static inline int rpmh_mode_solver_set(struct rpmh_client *rc, bool enable)
78{ return -ENODEV; }
79
Lina Iyerd7194ff2016-04-20 17:13:34 -060080static inline int rpmh_write_control(struct rpmh_client *rc,
81 struct tcs_cmd *cmd, int n)
82{ return -ENODEV; }
83
84static inline int rpmh_invalidate(struct rpmh_client *rc)
85{ return -ENODEV; }
86
Lina Iyer4a8655f2017-08-15 11:30:08 -060087static inline int rpmh_ctrlr_idle(struct rpmh_client *rc)
88{ return -ENODEV; }
89
Lina Iyerd7194ff2016-04-20 17:13:34 -060090static inline int rpmh_flush(struct rpmh_client *rc)
91{ return -ENODEV; }
92
93static inline int rpmh_read(struct rpmh_client *rc, u32 addr,
94 u32 *resp)
95{ return -ENODEV; }
96
97static inline struct rpmh_client *rpmh_get_byname(struct platform_device *pdev,
98 const char *name)
99{ return ERR_PTR(-ENODEV); }
100
101static inline struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev,
102 int index)
103{ return ERR_PTR(-ENODEV); }
104
105static inline void rpmh_release(struct rpmh_client *rc) { }
106#endif /* CONFIG_QTI_RPMH_API */
107
108#endif /* __SOC_QCOM_RPMH_H__ */