Lines Matching refs:hikey
165 static void interactive_power_init(struct hikey_power_module __unused *hikey) in interactive_power_init() argument
188 static int interactive_boostpulse(struct hikey_power_module *hikey) in interactive_boostpulse() argument
193 if (hikey->boostpulse_fd < 0) in interactive_boostpulse()
194 hikey->boostpulse_fd = open(INTERACTIVE_BOOSTPULSE_PATH, O_WRONLY); in interactive_boostpulse()
196 if (hikey->boostpulse_fd < 0) { in interactive_boostpulse()
197 if (!hikey->boostpulse_warned) { in interactive_boostpulse()
201 hikey->boostpulse_warned = 1; in interactive_boostpulse()
203 return hikey->boostpulse_fd; in interactive_boostpulse()
206 len = write(hikey->boostpulse_fd, "1", 1); in interactive_boostpulse()
217 hikey_devfreq_set_interactive(struct hikey_power_module __unused *hikey, int on) in hikey_devfreq_set_interactive() argument
234 static void hikey_devfreq_init(struct hikey_power_module __unused *hikey) in hikey_devfreq_init() argument
255 static int schedtune_sysfs_boost(struct hikey_power_module *hikey, char* booststr) in schedtune_sysfs_boost() argument
260 if (hikey->schedtune_boost_fd < 0) in schedtune_sysfs_boost()
261 return hikey->schedtune_boost_fd; in schedtune_sysfs_boost()
263 len = write(hikey->schedtune_boost_fd, booststr, strlen(booststr)); in schedtune_sysfs_boost()
273 struct hikey_power_module *hikey = (struct hikey_power_module *)arg; in schedtune_deboost_thread() local
276 sem_wait(&hikey->signal_lock); in schedtune_deboost_thread()
280 pthread_mutex_lock(&hikey->lock); in schedtune_deboost_thread()
282 if (hikey->deboost_time > now) { in schedtune_deboost_thread()
283 sleeptime = hikey->deboost_time - now; in schedtune_deboost_thread()
284 pthread_mutex_unlock(&hikey->lock); in schedtune_deboost_thread()
289 schedtune_sysfs_boost(hikey, schedtune_boost_norm); in schedtune_deboost_thread()
290 hikey_devfreq_set_interactive(hikey, 0); in schedtune_deboost_thread()
291 hikey->deboost_time = 0; in schedtune_deboost_thread()
292 pthread_mutex_unlock(&hikey->lock); in schedtune_deboost_thread()
299 static int schedtune_boost(struct hikey_power_module *hikey) in schedtune_boost() argument
303 if (hikey->schedtune_boost_fd < 0) in schedtune_boost()
304 return hikey->schedtune_boost_fd; in schedtune_boost()
307 if (!hikey->deboost_time) { in schedtune_boost()
308 schedtune_sysfs_boost(hikey, schedtune_boost_interactive); in schedtune_boost()
309 hikey_devfreq_set_interactive(hikey, 1); in schedtune_boost()
310 sem_post(&hikey->signal_lock); in schedtune_boost()
312 hikey->deboost_time = now + schedtune_boost_time_ns; in schedtune_boost()
317 static void schedtune_power_init(struct hikey_power_module *hikey) in schedtune_power_init() argument
322 hikey->deboost_time = 0; in schedtune_power_init()
323 sem_init(&hikey->signal_lock, 0, 1); in schedtune_power_init()
325 hikey->schedtune_boost_fd = open(SCHEDTUNE_BOOST_PATH, O_RDWR); in schedtune_power_init()
326 if (hikey->schedtune_boost_fd < 0) { in schedtune_power_init()
337 if (hikey->schedtune_boost_fd >= 0) { in schedtune_power_init()
338 size_t len = read(hikey->schedtune_boost_fd, schedtune_boost_norm, in schedtune_power_init()
350 pthread_create(&tid, NULL, schedtune_deboost_thread, hikey); in schedtune_power_init()
372 static void hikey_cpufreq_init(struct hikey_power_module __unused *hikey) in hikey_cpufreq_init() argument
405 struct hikey_power_module *hikey = &this_power_module; in power_init() local
406 memset(hikey, 0, sizeof(struct hikey_power_module)); in power_init()
407 pthread_mutex_init(&hikey->lock, NULL); in power_init()
408 hikey->boostpulse_fd = -1; in power_init()
409 hikey->boostpulse_warned = 0; in power_init()
411 hikey_cpufreq_init(hikey); in power_init()
412 hikey_devfreq_init(hikey); in power_init()
413 interactive_power_init(hikey); in power_init()
414 schedtune_power_init(hikey); in power_init()
429 struct hikey_power_module *hikey = &this_power_module; in power_hint() local
431 pthread_mutex_lock(&hikey->lock); in power_hint()
434 hikey_hint_interaction(hikey); in power_hint()
448 pthread_mutex_unlock(&hikey->lock); in power_hint()