Пример #1
0
static ssize_t level_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct lcdfreq_info *info = dev_get_lcdfreq(dev);
	unsigned int value;
	int ret;

	if (!info->enable) {
		dev_err(info->dev, "%s reject. enable flag is %d\n", __func__, info->enable);
		return -EINVAL;
	}

	ret = kstrtoul(buf, 0, (unsigned long *)&value);

	dev_info(info->dev, "%s :: value=%d\n", __func__, value);

	if (value >= LEVEL_MAX)
		return -EINVAL;

	if (value)
		ret = lcdfreq_lock(info->dev, value);
	else
		ret = lcdfreq_lock_free(info->dev);

	if (ret) {
		dev_err(info->dev, "%s skip\n", __func__);
		return -EINVAL;
	}
#ifdef CONFIG_MACH_T0
	tsp_lcd_infom((bool *)value);
#endif
	return count;
}
Пример #2
0
static ssize_t level_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int value;
	int ret;

	ret = strict_strtoul(buf, 0, (unsigned long *)&value);

	dev_info(dev, "\t%s :: value=%d\n", __func__, value);

	if (value >= LCDFREQ_LEVEL_END)
		return -EINVAL;

	if (value)
		ret = lcdfreq_lock(dev);
	else
		ret = lcdfreq_lock_free(dev);

	if (ret) {
		dev_err(dev, "%s fail\n", __func__);
		return -EINVAL;
	}

	return count;
}
Пример #3
0
int _lcdfreq_lock(int lock)
{
	int ext_lock;
	if(ddev != NULL) {
		ext_lock = atomic_read(usagep);
		if(!!lock && !ext_lock) {
			return lcdfreq_lock(ddev);
		} else if(!!ext_lock) {
			return lcdfreq_lock_free(ddev);
		}
	}
	
	return -EINVAL;
}