Esempio n. 1
0
static int mdnie_setup(struct s5p_fimd_ext_device *fx_dev, unsigned int enable)
{
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);
	struct mdnie_manager_ops *mops = mdnie->mops;
	int ret = 0;

	mdnie_info("enable[%d]", enable);
	if (enable) {
		int i;
		mdnie_init_hardware(mdnie);
		if (mops && mops->commit) {
			for (i = 0; i < SET_MAX; i++) {
				ret = mops->commit(mdnie, i);
				if (ret) {
					dev_err(mdnie->dev, "invalid mdnie set.\n");
					goto error;
				}
			}
		} else {
			dev_err(mdnie->dev, "invalid mdnie mops.\n");
			goto error;
		}
	}

	return 0;

error:
	return ret;
}
static int s5p_fimd_lite_start(struct s5p_fimd_ext_device *fx_dev)
{
	struct s5p_fimd_lite *fimd_lite = fimd_ext_get_drvdata(fx_dev);

	s5p_fimd_lite_lcd_on(fimd_lite, 1);

	return 0;
}
Esempio n. 3
0
static ssize_t show_mdnie_tune(struct device *dev,
			struct device_attribute *attr,
			char *buf)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);

	mdnie_info("tune[%d]", mdnie->tune);
	return snprintf(buf, PAGE_SIZE, "%d\n", mdnie->tune);
}
Esempio n. 4
0
static ssize_t show_read_reg(struct device *dev, struct device_attribute *attr,
			char *buf)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);

	if (!mdnie->regs) {
		dev_err(dev, "failed to get current register.\n");
		return -EINVAL;
	}

	return mdnie_read_reg(mdnie, buf);
}
static ssize_t show_read_reg(struct device *dev, struct device_attribute *attr,
			char *buf)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_fimd_lite *fimd_lite = fimd_ext_get_drvdata(fx_dev);

	if (!fimd_lite->iomem_base) {
		dev_err(dev, "failed to get current register.\n");
		return -EINVAL;
	}

	return s5p_fimd_lite_read_reg(fimd_lite, buf);
}
Esempio n. 6
0
static ssize_t store_mdnie_outdoor(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);
	struct mdnie_manager_ops *mops = mdnie->mops;
	unsigned long prev_outdoor;
	unsigned long outdoor;
	int ret;

	ret = kstrtoul(buf, 0, &outdoor);
	if (ret) {
		dev_err(&fx_dev->dev, "invalid outdoor value.\n");
		return -EINVAL;
	}

	if (outdoor >= OUTDOOR_MAX) {
		dev_err(&fx_dev->dev, "invalid mdnie outdoor.\n");
		return -EINVAL;
	}

	if (mdnie->scenario != SCENARIO_VIDEO
		&& mdnie->scenario != SCENARIO_CAMERA) {
		/* Set to default */
		mdnie->outdoor = OUTDOOR_OFF;
		dev_err(&fx_dev->dev, "invalid mdnie scenario.\n");
		return -EIO;
	}

	prev_outdoor = mdnie->outdoor;
	mdnie->outdoor = outdoor;
	mdnie_info("outdoor[%d]", mdnie->outdoor);
	if (mops && mops->commit) {
		ret = mops->commit(mdnie, SET_OPTIONAL);
		if (ret) {
			dev_err(&fx_dev->dev, "failed to set outdoor.\n");
			goto error_restore;
		}
	} else {
		dev_err(&fx_dev->dev, "invalid mdnie mops.\n");
		ret = -EINVAL;
		goto error_restore;
	}

	return count;

error_restore:
	mdnie->outdoor = prev_outdoor;
	return ret;
}
Esempio n. 7
0
static ssize_t store_mdnie_tone(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);
	struct mdnie_manager_ops *mops = mdnie->mops;
	unsigned long prev_tone;
	unsigned long tone;
	int ret;

	ret = kstrtoul(buf, 0, &tone);
	if (ret) {
		dev_err(&fx_dev->dev, "invalid tone value.\n");
		return -EINVAL;
	}

	if (mops && mops->check_tone) {
		ret = mops->check_tone(mdnie, tone);
		if (ret) {
			dev_err(&fx_dev->dev, "failed to set tone.\n");
			return ret;
		}
	} else {
		dev_err(&fx_dev->dev, "invalid mdnie mops.\n");
		ret = -EINVAL;
		goto error_mops;
	}

	prev_tone = mdnie->tone;
	mdnie->tone = tone;
	mdnie_info("tone[%d]", mdnie->tone);
	if (mops && mops->commit) {
		ret = mops->commit(mdnie, SET_OPTIONAL);
		if (ret) {
			dev_err(&fx_dev->dev, "failed to set tone.\n");
			goto error_restore;
		}
	} else {
		dev_err(&fx_dev->dev, "invalid mdnie mops.\n");
		ret = -EINVAL;
		goto error_restore;
	}

	return count;

error_restore:
	mdnie->tone = prev_tone;
error_mops:
	return ret;
}
static int s5p_fimd_lite_setup(struct s5p_fimd_ext_device *fx_dev,
				unsigned int enable)
{
	struct s5p_fimd_lite *fimd_lite = fimd_ext_get_drvdata(fx_dev);

	s5p_fimd_lite_logic_start(fimd_lite, enable);

	s5p_fimd_lite_lcd_init(fimd_lite);


	s5p_fimd_lite_window_on(fimd_lite, 0, 1);

	return 0;
}
Esempio n. 9
0
static ssize_t store_mdnie_mode(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);
	struct mdnie_manager_ops *mops = mdnie->mops;
	unsigned long prev_mode;
	unsigned long mode;
	int ret;

	ret = kstrtoul(buf, 0, &mode);
	if (ret) {
		dev_err(&fx_dev->dev, "invalid mode value.\n");
		return -EINVAL;
	}

	if (mode >= MODE_MAX) {
		dev_err(&fx_dev->dev, "invalid mdnie mode.\n");
		return -EINVAL;
	}

	if (mdnie->scenario >= SCENARIO_MODE_MAX) {
		dev_err(&fx_dev->dev, "invalid mdnie scenario.\n");
		mdnie->scenario = SCENARIO_UI;
	}

	prev_mode = mdnie->mode;
	mdnie->mode = mode;
	mdnie_info("mode[%d]", mdnie->mode);
	if (mops && mops->commit) {
		ret = mops->commit(mdnie, SET_MAIN);
		if (ret) {
			dev_err(&fx_dev->dev, "failed to set mode.\n");
			goto error_restore;
		}
	} else {
		dev_err(&fx_dev->dev, "invalid mdnie mops.\n");
		ret = -EINVAL;
		goto error_restore;
	}

	return count;

error_restore:
	mdnie->mode = prev_mode;
	return ret;
}
Esempio n. 10
0
static ssize_t store_mdnie_tune(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t count)
{
	struct s5p_fimd_ext_device *fx_dev = to_fimd_ext_device(dev);
	struct s5p_mdnie *mdnie = fimd_ext_get_drvdata(fx_dev);
	struct mdnie_manager_ops *mops = mdnie->mops;
	unsigned long prev_tune;
	unsigned long tune;
	int ret;

	ret = kstrtoul(buf, 0, &tune);
	if (ret) {
		dev_err(&fx_dev->dev, "invalid tune value.\n");
		return -EINVAL;
	}

	if (tune >= TUNE_MAX) {
		dev_err(&fx_dev->dev, "invalid mdnie tune.\n");
		return -EINVAL;
	}

	prev_tune = mdnie->tune;
	mdnie->tune = tune;
	mdnie_info("tune[%d]", mdnie->tune);
	if (mops) {
		if (mdnie->tune == TUNE_FW)
			mops->tune = mdnie_request_fw;
		else
			mops->tune = mdnie_request_tables;
	} else {
		dev_err(&fx_dev->dev, "invalid mdnie mops.\n");
		ret = -EINVAL;
		goto error_restore;
	}

	return count;

error_restore:
	mdnie->tune = prev_tune;
	return ret;
}
Esempio n. 11
0
static void s5p_fimd_lite_power_off(struct s5p_fimd_ext_device *fx_dev)
{
	struct s5p_fimd_lite *fimd_lite = fimd_ext_get_drvdata(fx_dev);

	clk_disable(fimd_lite->clk);
}
Esempio n. 12
0
static void s5p_fimd_lite_stop(struct s5p_fimd_ext_device *fx_dev)
{
	struct s5p_fimd_lite *fimd_lite = fimd_ext_get_drvdata(fx_dev);

	s5p_fimd_lite_lcd_on(fimd_lite, 0);
}