static void huawei_power_hint(struct power_module *module, power_hint_t hint,
                            void *data)
{
    struct huawei_power_module *huawei = (struct huawei_power_module *) module;
    char buf[80];
    int len;

    switch (hint) {
    case POWER_HINT_INTERACTION:
        if (boostpulse_open(huawei) >= 0) {
	    len = write(huawei->boostpulse_fd, "1", 1);

	    if (len < 0) {
	        strerror_r(errno, buf, sizeof(buf));
		ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf);
	    }
	}
        break;

    case POWER_HINT_VSYNC:
        break;

    default:
        break;
    }
}
/*
 * This functions is called to pass hints on power requirements, which may
 * result in adjustment of power/performance parameters of the cpufreq governor
 * and other controls.
 */
static void exynos5433_power_hint(struct power_module *module, power_hint_t hint,
                             void *data)
{
    struct exynos5433_power_module *exynos5433_pwr = (struct exynos5433_power_module *) module;
    char errno_str[64];
    int len;

    switch (hint) {
        case POWER_HINT_INTERACTION:
            if (boostpulse_open(exynos5433_pwr) >= 0) {
                len = write(exynos5433_pwr->boostpulse_fd, "1", 1);

                if (len < 0) {
                    strerror_r(errno, errno_str, sizeof(errno_str));
                    ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, errno_str);
                }
            }

            break;

        case POWER_HINT_VSYNC:
            break;

        default:
            break;
    }
}
static void universal5420_power_hint(struct power_module *module, power_hint_t hint,
                       void *data) {
    struct universal5420_power_module *universal5420 = (struct universal5420_power_module *) module;
    struct timespec now, diff;
    char buf[80];
    int len;
    switch (hint) {
    case POWER_HINT_INTERACTION:
        if (boostpulse_open(universal5420) >= 0) {
            pthread_mutex_lock(&universal5420->lock);
            len = write(universal5420->boostpulse_fd, "1", 1);

            if (len < 0) {
                strerror_r(errno, buf, sizeof(buf));
                ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf);
            } else {
                clock_gettime(CLOCK_MONOTONIC, &last_touch_boost);
                touch_boost = true;
            }
            pthread_mutex_unlock(&universal5420->lock);
        }

        break;

    case POWER_HINT_VSYNC:
        pthread_mutex_lock(&universal5420->lock);
        if (data) {
            if (vsync_count < UINT_MAX)
                vsync_count++;
        } else {
            if (vsync_count)
                vsync_count--;
            if (vsync_count == 0 && touch_boost) {
                touch_boost = false;
                clock_gettime(CLOCK_MONOTONIC, &now);
                diff = timespec_diff(now, last_touch_boost);
                if (check_boostpulse_on(diff)) {
                    sysfs_write(BOOST_PATH, "0");
                }
            }
        }
        pthread_mutex_unlock(&universal5420->lock);
        break;

    default:
        break;
    }
}
示例#4
0
static void cm_power_hint(struct power_module *module, power_hint_t hint,
                            void *data)
{
    struct cm_power_module *cm = (struct cm_power_module *) module;
    char buf[80];
    int len;
    int duration = 1;

    switch (hint) {
#ifndef NO_TOUCH_BOOST
    case POWER_HINT_INTERACTION:
#endif
    case POWER_HINT_CPU_BOOST:
        if (boostpulse_open(cm) >= 0) {
            if (data != NULL)
                duration = (int) data;

            snprintf(buf, sizeof(buf), "%d", duration);
            len = write(cm->boostpulse_fd, buf, strlen(buf));

            if (len < 0) {
                strerror_r(errno, buf, sizeof(buf));
                ALOGE("Error writing to boostpulse: %s\n", buf);

                pthread_mutex_lock(&cm->lock);
                close(cm->boostpulse_fd);
                cm->boostpulse_fd = -1;
                cm->boostpulse_warned = 0;
                pthread_mutex_unlock(&cm->lock);
            }
        }
        break;

    case POWER_HINT_VSYNC:
        break;

    default:
        break;
    }
}
static void flounder_power_hint(struct power_module *module, power_hint_t hint,
                                void *data)
{
    struct flounder_power_module *flounder =
            (struct flounder_power_module *) module;
    char buf[80];
    int len;

    switch (hint) {
     case POWER_HINT_INTERACTION:
        if (boostpulse_open(flounder) >= 0) {
            len = write(flounder->boostpulse_fd, "1", 1);

            if (len < 0) {
                strerror_r(errno, buf, sizeof(buf));
                ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf);
            }
        }

        break;

   case POWER_HINT_VSYNC:
        break;

    case POWER_HINT_LOW_POWER:
        pthread_mutex_lock(&flounder->lock);
        if (data) {
            sysfs_write(CPU_MAX_FREQ_PATH, low_power_max_cpu_freq);
        } else {
            sysfs_write(CPU_MAX_FREQ_PATH, max_cpu_freq);
        }
        low_power_mode = data;
        pthread_mutex_unlock(&flounder->lock);
        break;

    default:
            break;
    }
}