1 /* drivers/gpu/t6xx/kbase/src/platform/rk/mali_kbase_platform.h 2 * Rockchip SoC Mali-Midgard platform-dependent codes 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software FoundatIon. 7 */ 8 9 /** 10 * @file mali_kbase_rk.h 11 * 12 * defines work_context type of platform_dependent_part. 13 */ 14 15 #ifndef _MALI_KBASE_RK_H_ 16 #define _MALI_KBASE_RK_H_ 17 18 #include <linux/wakelock.h> 19 20 /*---------------------------------------------------------------------------*/ 21 22 #define DEFAULT_UTILISATION_PERIOD_IN_MS (100) 23 24 /*---------------------------------------------------------------------------*/ 25 26 /* 27 * struct rk_context - work_context of platform_dependent_part_of_rk. 28 */ 29 struct rk_context { 30 /* 31 * record the status of common_parts calling 'power_on_callback' 32 * and 'power_off_callback'. 33 */ 34 bool is_powered; 35 36 bool is_regulator_on; 37 38 struct kbase_device *kbdev; 39 40 struct workqueue_struct *power_off_wq; 41 /* delayed_work_to_power_off_gpu. */ 42 struct delayed_work work; 43 unsigned int delay_ms; 44 45 /* 46 * WAKE_LOCK_SUSPEND for ensuring to run 47 * delayed_work_to_power_off_gpu before suspend. 48 */ 49 struct wake_lock wake_lock; 50 51 /* debug only, the period in ms to count gpu_utilisation. */ 52 unsigned int utilisation_period; 53 54 /* to protect operations on 'is_powered' and clks, pd, vd of gpu. */ 55 struct mutex lock; 56 }; 57 58 /*---------------------------------------------------------------------------*/ 59 get_rk_context(const struct kbase_device * kbdev)60static inline struct rk_context *get_rk_context( 61 const struct kbase_device *kbdev) 62 { 63 return (struct rk_context *)(kbdev->platform_context); 64 } 65 66 #endif /* _MALI_KBASE_RK_H_ */ 67 68