static ssize_t mode_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct mdnie_info *mdnie = dev_get_drvdata(dev);
	unsigned int value = 0;
	int ret;
	int result[5] = {0,};

	ret = kstrtouint(buf, 0, &value);
	if (ret < 0)
		return ret;

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

	if (value >= MODE_MAX) {
		value = STANDARD;
		return -EINVAL;
	}

	mutex_lock(&mdnie->lock);
	mdnie->mode = value;
	mutex_unlock(&mdnie->lock);

	if (!mdnie->color_correction) {
		ret = get_panel_coordinate(mdnie, result);
		if (ret > 0)
			update_color_position(mdnie, ret);
	}

	mdnie_update(mdnie);

	return count;
}
Exemplo n.º 2
0
static ssize_t mode_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct mdnie_info *mdnie = dev_get_drvdata(dev);
	unsigned int value = 0;
	int ret;
#if !defined(CONFIG_FB_MDNIE_PWM)
	int result[5] = {0,};
#endif

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

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

	if (value >= MODE_MAX) {
		value = STANDARD;
		return -EINVAL;
	}

	mutex_lock(&mdnie->lock);
	mdnie->mode = value;
	mutex_unlock(&mdnie->lock);

#if !defined(CONFIG_FB_MDNIE_PWM)
	if (!mdnie->color_correction) {
		ret = get_panel_coordinate(mdnie, result);
		if (ret > 0)
			update_color_position(mdnie, ret - 1);
	}
#endif

	mdnie_update(mdnie);
#if defined(CONFIG_FB_MDNIE_PWM)
	if ((mdnie->enable) && (mdnie->bd_enable))
		update_brightness(mdnie);
#endif

	return count;
}
Exemplo n.º 3
0
void update_mdnie_coordinate( u16 coordinate0, u16 coordinate1 )
{
	struct mdnie_info *mdnie = g_mdnie;
	int ret;
	int result[5] = {0,};

	if( mdnie == NULL ) {
		pr_err( "%s : mdnie has not initialized\n", __func__ );
		return;
	}

	pr_info( "%s : reload MDNIE-MTP\n", __func__ );

	mdnie->coordinate[0] = coordinate0;
	mdnie->coordinate[1] = coordinate1;

	ret = get_panel_coordinate(mdnie, result);
	if (ret > 0)
		update_color_position(mdnie, ret);

	return;
}