123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- #ifndef _SDE_POWER_HANDLE_H_
- #define _SDE_POWER_HANDLE_H_
- #define MAX_CLIENT_NAME_LEN 128
- #define SDE_POWER_HANDLE_ENABLE_BUS_AB_QUOTA 0
- #define SDE_POWER_HANDLE_DISABLE_BUS_AB_QUOTA 0
- #define SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA 400000000
- #define SDE_POWER_HANDLE_ENABLE_NRT_BUS_IB_QUOTA 0
- #define SDE_POWER_HANDLE_DISABLE_BUS_IB_QUOTA 0
- #define SDE_POWER_HANDLE_CONT_SPLASH_BUS_IB_QUOTA 3000000000ULL
- #define SDE_POWER_HANDLE_CONT_SPLASH_BUS_AB_QUOTA 3000000000ULL
- #include <linux/sde_io_util.h>
- #include <linux/interconnect.h>
- #define SDE_POWER_EVENT_PRE_DISABLE 0x1
- #define SDE_POWER_EVENT_POST_DISABLE 0x2
- #define SDE_POWER_EVENT_PRE_ENABLE 0x4
- #define SDE_POWER_EVENT_POST_ENABLE 0x8
- #define SDE_POWER_EVENT_MMRM_CALLBACK 0x10
- #define DATA_BUS_PATH_MAX 0x2
- #define QCOM_ICC_BUCKET_AMC 0
- #define QCOM_ICC_BUCKET_WAKE 1
- #define QCOM_ICC_BUCKET_SLEEP 2
- #define QCOM_ICC_NUM_BUCKETS 3
- #define QCOM_ICC_TAG_AMC BIT(QCOM_ICC_BUCKET_AMC)
- #define QCOM_ICC_TAG_WAKE BIT(QCOM_ICC_BUCKET_WAKE)
- #define QCOM_ICC_TAG_SLEEP BIT(QCOM_ICC_BUCKET_SLEEP)
- #define QCOM_ICC_TAG_ACTIVE_ONLY (QCOM_ICC_TAG_AMC | QCOM_ICC_TAG_WAKE)
- #define QCOM_ICC_TAG_ALWAYS (QCOM_ICC_TAG_AMC | QCOM_ICC_TAG_WAKE |\
- QCOM_ICC_TAG_SLEEP)
- enum mdss_bus_vote_type {
- VOTE_INDEX_DISABLE,
- VOTE_INDEX_LOW,
- VOTE_INDEX_MEDIUM,
- VOTE_INDEX_HIGH,
- VOTE_INDEX_MAX,
- };
- enum sde_power_handle_data_bus_client {
- SDE_POWER_HANDLE_DATA_BUS_CLIENT_RT,
- SDE_POWER_HANDLE_DATA_BUS_CLIENT_NRT,
- SDE_POWER_HANDLE_DATA_BUS_CLIENT_MAX
- };
- enum SDE_POWER_HANDLE_DBUS_ID {
- SDE_POWER_HANDLE_DBUS_ID_MNOC,
- SDE_POWER_HANDLE_DBUS_ID_LLCC,
- SDE_POWER_HANDLE_DBUS_ID_EBI,
- SDE_POWER_HANDLE_DBUS_ID_MAX,
- };
- struct sde_power_bus_scaling_data {
- uint64_t ab;
- uint64_t ib;
- };
- struct sde_power_data_bus_handle {
- struct icc_path *data_bus_hdl[DATA_BUS_PATH_MAX];
- struct sde_power_bus_scaling_data curr_val;
- u32 data_paths_cnt;
- bool bus_active_only;
- };
- struct sde_power_reg_bus_handle {
- struct icc_path *reg_bus_hdl;
- enum mdss_bus_vote_type curr_idx;
- struct sde_power_bus_scaling_data scale_table[VOTE_INDEX_MAX];
- };
- struct sde_power_event {
- char client_name[MAX_CLIENT_NAME_LEN];
- void (*cb_fnc)(u32 event_type, void *usr);
- void *usr;
- u32 event_type;
- struct list_head list;
- bool active;
- };
- struct sde_power_mmrm_reserve {
- char clk_name[32];
- u64 clk_rate;
- };
- struct sde_power_handle {
- struct dss_module_power mp;
- struct mutex phandle_lock;
- struct device *dev;
- struct sde_power_reg_bus_handle reg_bus_handle;
- struct sde_power_data_bus_handle data_bus_handle
- [SDE_POWER_HANDLE_DBUS_ID_MAX];
- struct list_head event_list;
- u32 last_event_handled;
- struct sde_rsc_client *rsc_client;
- bool rsc_client_init;
- bool mmrm_enable;
- u64 ib_quota[SDE_POWER_HANDLE_DBUS_ID_MAX];
- struct sde_power_mmrm_reserve mmrm_reserve;
- };
- int sde_power_resource_init(struct platform_device *pdev,
- struct sde_power_handle *pdata);
- void sde_power_resource_deinit(struct platform_device *pdev,
- struct sde_power_handle *pdata);
- int sde_power_resource_enable(struct sde_power_handle *pdata, bool enable);
- int sde_power_scale_reg_bus(struct sde_power_handle *phandle,
- u32 usecase_ndx, bool skip_lock);
- int sde_power_data_bus_state_update(struct sde_power_handle *phandle,
- bool enable);
- int sde_power_clk_reserve_rate(struct sde_power_handle *pdata, char *clock_name, u64 rate);
- int sde_power_clk_set_rate(struct sde_power_handle *pdata, char *clock_name,
- u64 rate, u32 flags);
- int sde_power_mmrm_set_clk_limit(struct dss_clk *clk,
- struct sde_power_handle *phandle, unsigned long requested_clk);
- u64 sde_power_mmrm_get_requested_clk(struct sde_power_handle *pdata,
- char *clock_name);
- u64 sde_power_clk_get_rate(struct sde_power_handle *pdata, char *clock_name);
- u64 sde_power_clk_get_max_rate(struct sde_power_handle *pdata,
- char *clock_name);
- struct clk *sde_power_clk_get_clk(struct sde_power_handle *phandle,
- char *clock_name);
- int sde_power_data_bus_set_quota(struct sde_power_handle *phandle,
- u32 bus_id, u64 ab_quota, u64 ib_quota);
- void sde_power_data_bus_bandwidth_ctrl(struct sde_power_handle *phandle,
- int enable);
- struct sde_power_event *sde_power_handle_register_event(
- struct sde_power_handle *phandle,
- u32 event_type, void (*cb_fnc)(u32 event_type, void *usr),
- void *usr, char *client_name);
- void sde_power_handle_unregister_event(struct sde_power_handle *phandle,
- struct sde_power_event *event);
- const char *sde_power_handle_get_dbus_name(u32 bus_id);
- #endif
|