static int boostpulse_open(struct cm_power_module *cm) { char buf[80]; pthread_mutex_lock(&cm->lock); if (cm->boostpulse_fd < 0) { if (get_scaling_governor() < 0) { ALOGE("Can't read scaling governor."); cm->boostpulse_warned = 1; } else { if (strncmp(governor, ONDEMAND_GOVERNOR, 8) == 0) cm->boostpulse_fd = open(BOOSTPULSE_ONDEMAND, O_WRONLY); else if (strncmp(governor, INTERACTIVE_GOVERNOR, 11) == 0) cm->boostpulse_fd = open(BOOSTPULSE_INTERACTIVE, O_WRONLY); if (cm->boostpulse_fd < 0 && !cm->boostpulse_warned) { strerror_r(errno, buf, sizeof(buf)); ALOGV("Error opening boostpulse: %s\n", buf); cm->boostpulse_warned = 1; } else if (cm->boostpulse_fd > 0) { configure_governor(); ALOGD("Opened %s boostpulse interface", governor); } } } pthread_mutex_unlock(&cm->lock); return cm->boostpulse_fd; }
static int boostpulse_open(struct lge_power_module *lge) { char buf[80]; pthread_mutex_lock(&lge->lock); if (lge->boostpulse_fd < 0) { if (get_scaling_governor() < 0) { ALOGE("Can't read scaling governor."); lge->boostpulse_warned = 1; } else { if (strncmp(governor, "ondemand", 8) == 0) lge->boostpulse_fd = open(BOOSTPULSE_ONDEMAND, O_WRONLY); else if (strncmp(governor, "interactive", 11) == 0) lge->boostpulse_fd = open(BOOSTPULSE_INTERACTIVE, O_WRONLY); else if (strncmp(governor, "smartassV2", 10) == 0) lge->boostpulse_fd = open(BOOSTPULSE_SMARTASS2, O_WRONLY); if (lge->boostpulse_fd < 0 && !lge->boostpulse_warned) { strerror_r(errno, buf, sizeof(buf)); ALOGV("Error opening boostpulse: %s\n", buf); lge->boostpulse_warned = 1; } else if (lge->boostpulse_fd > 0) { configure_governor(); ALOGD("Opened %s boostpulse interface", governor); } } } pthread_mutex_unlock(&lge->lock); return lge->boostpulse_fd; }
static void cm_power_init(struct power_module *module) { get_scaling_governor(); configure_governor(); }