Exemple #1
0
int mdnie_send_sequence(struct mdnie_info *mdnie, const unsigned short *seq)
{
	int ret = 0, i = 0;
	const unsigned short *wbuf;

	if (IS_ERR_OR_NULL(seq)) {
		dev_err(mdnie->dev, "mdnie sequence is null\n");
		return -EPERM;
	}

	mutex_lock(&mdnie->dev_lock);

	wbuf = seq;

	s3c_mdnie_mask();

	while (wbuf[i] != END_SEQ) {
		mdnie_write(wbuf[i], wbuf[i+1]);
		i += 2;
	}

	s3c_mdnie_unmask();

	mutex_unlock(&mdnie->dev_lock);

	return ret;
}
Exemple #2
0
int mdnie_send_sequence(struct mdnie_info *mdnie, const unsigned short *seq)
{
	int ret = 0, i = 0;
	const unsigned short *wbuf;

	if (!mdnie->enable) {
		dev_err(mdnie->dev, "do not configure mDNIe after LCD/mDNIe power off\n");
		return -EPERM;
	}

	mutex_lock(&mdnie->dev_lock);

	wbuf = seq;

	s3c_mdnie_mask();

	while (wbuf[i] != END_SEQ) {
		mdnie_write(wbuf[i], wbuf[i+1]);
		i += 2;
	}

	s3c_mdnie_unmask();

	mutex_unlock(&mdnie->dev_lock);

	return ret;
}
Exemple #3
0
void mDNIe_Mode_set_for_backlight(u16 *buf)
{
	u32 i = 0;

			s3c_mdnie_mask();

			while ((*(buf+i)) != END_SEQ)
			{
				if((*(buf+i)) == 0x0100)
				{
					if(pre_0x0100 < (*(buf+(i+1)))){
						while ((pre_0x0100 < (*(buf+(i+1))))&&(pre_0x0100 <= 0x4020)&&(pre_0x0100 >= 0x0000))
						{
							s3c_mdnie_writel(pre_0x0100, (*(buf+i)));
							gprintk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x0100);

							if((pre_0x0100 & 0x00ff) == 0x20)
							{
								pre_0x0100 = ((pre_0x0100 & 0xff00) + (0x8<<8)) | (0x20);
							}
							else
							{
								pre_0x0100 = ((pre_0x0100 & 0xff00) + (0x8<<8)) | ((pre_0x0100 & 0x00ff) + (0x4));
							}
							msleep(20);
						}
					}
					else if(pre_0x0100 > (*(buf+(i+1)))){
						while (pre_0x0100 > (*(buf+(i+1)))&&(pre_0x0100 >= 0x0000)&&(pre_0x0100 <= 0x4020))
						{
							s3c_mdnie_writel(pre_0x0100, (*(buf+i)));
							gprintk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x0100);
							
							if((pre_0x0100 & 0x00ff) == 0x00)
							{
								pre_0x0100 = ((pre_0x0100 & 0xff00) - (0x8<<8)) | (0x00);
							}
							else
							{
								pre_0x0100 = ((pre_0x0100 & 0xff00) - (0x8<<8)) | ((pre_0x0100 & 0x00ff) - (0x4));
							}
							msleep(20);
						}
					}
					s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
					pre_0x0100 = (*(buf+i+1));
				}
				else
				{
					s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
				}
				gprintk("[mDNIe] mDNIe_Mode_set_for_backlight : addr(0x%x), data(0x%x)  \n",(*(buf+i)),(*(buf+(i+1))));	
				i+=2;
			}

			s3c_mdnie_unmask();

}
void mDNIe_tuning_set(void)
{
	u32 i = 0;

	s3c_mdnie_mask();
	while ( mDNIe_data[i] != END_SEQ)
	{
		s3c_mdnie_writel(mDNIe_data[i+1], mDNIe_data[i]);
		printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",mDNIe_data[i], mDNIe_data[i+1]);	
		i+=2;
	}
	s3c_mdnie_unmask();
}
Exemple #5
0
int mdnie_send_sequence(struct mdnie_info *mdnie, const unsigned short *seq)
{
	int ret = 0, i = 0;
	const unsigned short *wbuf;

	if (!mdnie->enable) {
		dev_err(mdnie->dev, "do not configure mDNIe after LCD/mDNIe power off\n");
		return -EPERM;
	}

	mutex_lock(&mdnie->dev_lock);

	wbuf = seq;

	s3c_mdnie_mask();

	while (wbuf[i] != END_SEQ) {
		if (g_mdnie->user_mode != 0x0000) {
			switch (wbuf[i]) {
				case 0x0063:
					mdnie_write(wbuf[i], g_mdnie->user_cb);
					break;
				case 0x0065:
					mdnie_write(wbuf[i], g_mdnie->user_cr);
					break;
				default:
					mdnie_write(wbuf[i], wbuf[i+1]);
					break;
			}
		} else {
			mdnie_write(wbuf[i], wbuf[i+1]);
		}

		i += 2;
	}

	s3c_mdnie_unmask();

	mutex_unlock(&mdnie->dev_lock);

	return ret;
}
Exemple #6
0
void mDNIe_Mode_Change(mDNIe_data_type *mode)
{

	if(mDNIe_Tuning_Mode == TRUE)
	{
		printk("mDNIe_Mode_Change [mDNIe_Tuning_Mode = TRUE, API is Return] \n");
		return;
	}
	else
	{
		s3c_mdnie_mask();
		while ( mode->addr != END_SEQ)
		{
			s3c_mdnie_writel(mode->data, mode->addr);
			gprintk(KERN_INFO "[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",mode->addr, mode->data);	
			mode++;
		}
		s3c_mdnie_unmask();
	}
}
void mDNIe_Mode_set_for_lightsensor(u16 *buf)
{
	u32 i = 0;
	int cnt = 0;

	s3c_mdnie_mask();
if(cur_adc_level >= pre_adc_level)	//0 => END_SEQ
{
	while ( (*(buf+i)) != END_SEQ)
	{
		if((*(buf+i)) == 0x0100)
		{
			if(init_mdnie == 0)
			{
				pre_0x0100 = (*(buf+(i+1)));
			}
			if(pre_0x0100 < (*(buf+(i+1)))){
				while ((pre_0x0100 < (*(buf+(i+1))))&&(pre_0x0100 <= 0x8080)&&(pre_0x0100 >= 0x0000))
				{
					s3c_mdnie_writel(pre_0x0100, (*(buf+i)));
					printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x0100);
					pre_0x0100 = ((pre_0x0100 & 0xff00) + (light_step<<8)) | ((pre_0x0100 & 0x00ff) + (saturation_step));
				}
			}
			else if(pre_0x0100 > (*(buf+(i+1)))){
				while (pre_0x0100 > (*(buf+(i+1)))&&(pre_0x0100 >= 0x0000)&&(pre_0x0100 <= 0x8080))
				{
					s3c_mdnie_writel(pre_0x0100, (*(buf+i)));
					printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x0100);
					pre_0x0100 = ((pre_0x0100 & 0xff00) - (light_step<<8)) | ((pre_0x0100 & 0x00ff) - (saturation_step));
				}
			}
			s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
			pre_0x0100 = (*(buf+i+1));
		}
		else if((*(buf+i)) == 0x00AC)
		{
			if(init_mdnie == 0)
			{
				pre_0x00AC = (*(buf+(i+1)));
			}
			if(pre_0x00AC < (*(buf+(i+1)))){
				while (pre_0x00AC < (*(buf+(i+1)))&&(pre_0x00AC <= 0x03ff)&&(pre_0x00AC >= 0x0000))
				{
					s3c_mdnie_writel(pre_0x00AC, (*(buf+i)));
					printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x00AC);
					pre_0x00AC +=(cs_step);
				}
			}
			else if(pre_0x00AC > (*(buf+(i+1)))){
				while (pre_0x00AC > (*(buf+(i+1)))&&(pre_0x00AC >= 0x0000)&&(pre_0x00AC <= 0x03ff))
				{
					s3c_mdnie_writel(pre_0x00AC, (*(buf+i)));
					printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),pre_0x00AC);
					pre_0x00AC -=(cs_step);
				}
			}
			s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
			pre_0x00AC = (*(buf+i+1));
		}
		else
		{
			s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
		}
		printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+i)),(*(buf+(i+1))));	
		i+=2;
	}
}
else // if(cur_adc_level < pre_adc_level)  //END_SEQ => 0
{
		switch (cur_adc_level) {
		case 0:
			cnt = mDNIe_data_level0_cnt;
			break;
		case 1:
			cnt = mDNIe_data_level1_cnt;
			break;
		case 2:
			cnt = mDNIe_data_level2_cnt;
			break;
		case 3:
		default:
			cnt = mDNIe_data_level3_cnt;
			break;
		case 4:
			cnt = mDNIe_data_level4_cnt;
			break;
		case 5:
			cnt = mDNIe_data_level5_cnt;
			break;
		}

		cnt--;	//remove END_SEQ

		while ( cnt > 0)	
		{
			if((*(buf+cnt-1)) == 0x0100)
			{
				if(init_mdnie == 0)
				{
					pre_0x0100 = (*(buf+cnt));
				}
				if(pre_0x0100 < (*(buf+cnt))){
					while ((pre_0x0100 < (*(buf+cnt)))&&(pre_0x0100 <= 0x8080)&&(pre_0x0100 >= 0x0000))
					{
						s3c_mdnie_writel(pre_0x0100, (*(buf+cnt-1)));
						printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+cnt-1)),pre_0x0100);
						pre_0x0100 = ((pre_0x0100 & 0xff00) + (light_step<<8)) | ((pre_0x0100 & 0x00ff) + (saturation_step));
					}
				}
				else if(pre_0x0100 > (*(buf+cnt))){
					while (pre_0x0100 > (*(buf+cnt))&&(pre_0x0100 >= 0x0000)&&(pre_0x0100 <= 0x8080))
					{
						s3c_mdnie_writel(pre_0x0100, (*(buf+cnt-1)));
						printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+cnt-1)),pre_0x0100);
						pre_0x0100 = ((pre_0x0100 & 0xff00) - (light_step<<8)) | ((pre_0x0100 & 0x00ff) - (saturation_step));
					}
				}
				s3c_mdnie_writel((*(buf+cnt)), (*(buf+cnt-1)));
				pre_0x0100 = (*(buf+cnt));
			}
			else if((*(buf+cnt-1)) == 0x00AC)
			{
				if(init_mdnie == 0)
				{
					pre_0x00AC = (*(buf+cnt));
				}
				if(pre_0x00AC < (*(buf+cnt))){
					while (pre_0x00AC < (*(buf+cnt))&&(pre_0x00AC <= 0x03ff)&&(pre_0x00AC >= 0x0000))
					{
						s3c_mdnie_writel(pre_0x00AC, (*(buf+cnt-1)));
						printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+cnt-1)),pre_0x00AC);
						pre_0x00AC +=(cs_step);
					}
				}
				else if(pre_0x00AC > (*(buf+cnt))){
					while (pre_0x00AC > (*(buf+cnt))&&(pre_0x00AC >= 0x0000)&&(pre_0x00AC <= 0x03ff))
					{
						s3c_mdnie_writel(pre_0x00AC, (*(buf+cnt-1)));
						printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+cnt-1)),pre_0x00AC);
						pre_0x00AC -=(cs_step);
					}
				}
				s3c_mdnie_writel((*(buf+cnt)), (*(buf+cnt-1)));
				pre_0x00AC = (*(buf+cnt));
			}
			else
			{
				//s3c_mdnie_writel((*(buf+i+1)), (*(buf+i)));
				s3c_mdnie_writel((*(buf+cnt)), (*(buf+cnt-1)));
			}
			
			printk("[mDNIe] mDNIe_tuning_initialize: addr(0x%x), data(0x%x)  \n",(*(buf+cnt-1)),(*(buf+cnt)));

			cnt -=2;
		}
}
	s3c_mdnie_unmask();
}