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; }
static ssize_t color_correct_show(struct device *dev, struct device_attribute *attr, char *buf) { struct mdnie_info *mdnie = dev_get_drvdata(dev); char *pos = buf; int i, idx, result[5] = {0,}; if (!mdnie->color_correction) return -EINVAL; idx = get_panel_coordinate(mdnie, result); for (i = 1; i < (int) ARRAY_SIZE(result); i++) pos += sprintf(pos, "f%d: %d, ", i, result[i]); pos += sprintf(pos, "tune%d\n", idx); return pos - buf; }
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; }
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; }