Пример #1
0
u32 calc_gamma_table(struct str_smart_dim *smart, u32 gv, u8 result[])
{
	u32 i, c;
	u32 temp;
	u32 lidx;
	u32 dv[CI_MAX][IV_MAX];
	s16 gamma[CI_MAX][IV_MAX];
	u16 offset;
	u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX]) = {
		calc_v1_reg,
		calc_v15_reg,
		calc_v35_reg,
		calc_v50_reg,
		calc_v87_reg,
		calc_v171_reg,
		calc_v255_reg,
	};

	memset(gamma, 0, sizeof(gamma));

	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][0] = smart->adjust_volt[c][AD_IV1];


	for (i = IV_15; i < IV_MAX; i++) {
		temp = smart->g22_tbl[dv_value[i]] * gv;
		lidx = lookup_vtbl_idx(smart, temp);
		for (c = CI_RED; c < CI_MAX; c++)
			dv[c][i] = smart->ve[lidx].v[c];
	}

	/* for IV1 does not calculate value */
	/* just use default gamma value (IV1) */
	for (c = CI_RED; c < CI_MAX; c++)
		gamma[c][IV_1] = smart->default_gamma[c];

	for (i = IV_15; i < IV_MAX; i++) {
		for (c = CI_RED; c < CI_MAX; c++)
			gamma[c][i] = (s16)calc_reg[i](c, dv) - smart->mtp[c][i];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		offset = IV_255*CI_MAX+c*2;
		result[offset+1] = gamma[c][IV_255];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		for (i = IV_1; i < IV_255; i++)
			result[(CI_MAX*i)+c] = gamma[c][i];
	}

#if 0
	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %04dV", color_name[c], dv[c][i]);
		printk("\n");
	}


	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %3d, 0x%2x", color_name[c], gamma[c][i], gamma[c][i]);
		printk("\n");
	}
#endif
	return 0;
}
u32 calc_gamma_table_22(struct str_smart_dim *smart, u32 gv, u8 result[])
{
	u32 i, c;
	u32 temp;
	u32 lidx_22;
	u32 dv[CI_MAX][IV_MAX];
	s16 gamma_22[CI_MAX][IV_MAX];
	u16 offset;
	u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX]) = {
		calc_v1_reg,
		calc_v19_reg,
		calc_v43_reg,
		calc_v87_reg,
		calc_v171_reg,
		calc_v255_reg,
	};

	//printk("%s was call Gamma : %d\n", __func__, gv);
	//printk("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
	
	memset(gamma_22, 0, sizeof(gamma_22));

#if 0
	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][0] = smart->adjust_volt[c][AD_IV1];
#endif

	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][IV_1] = smart->ve[AD_IV1].v[c];

	for (i = IV_19; i < IV_MAX; i++) {
		temp = ((smart->g2x_tbl[dv_value[i]]) * gv)/1000;
		//printk("temp : %d, g22 val : %d, gv : %d\n",temp,smart->g2x_tbl[dv_value[i]], gv);
		lidx_22 = lookup_vtbl_idx(smart, temp);
		//printk("M-Gray : [%3d] \n", lidx_22);
		for (c = CI_RED; c < CI_MAX; c++)
			dv[c][i] = smart->ve[lidx_22].v[c];
	}

	/* for IV1 does not calculate value */
	/* just use default gamma value (IV1) */
	for (c = CI_RED; c < CI_MAX; c++)
		gamma_22[c][IV_1] = smart->default_gamma[c];

	for (i = IV_19; i < IV_MAX; i++) {
		for (c = CI_RED; c < CI_MAX; c++)
			gamma_22[c][i] = (u16)calc_reg[i](c, dv) - smart->mtp[c][i];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		offset = IV_255*CI_MAX+c*2;
		result[offset+1] = gamma_22[c][IV_255];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		for (i = IV_1; i < IV_255; i++)
			result[(CI_MAX*i)+c] = gamma_22[c][i];
	}


#if 0
	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %04dV  ", color_name[c], dv[c][i]);
		printk("\n");
	}

	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("2.2Gamma %c : %3d, 0x%2x  ", color_name[c], gamma_22[c][i], gamma_22[c][i]);
		printk("\n");
	}
	printk(KERN_INFO "\n\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");	
#endif
	return 0;
}
Пример #3
0
u32 calc_gamma_table_215_190(struct str_smart_dim *smart, u32 gv, u8 result[])
{
	u32 i, c;
	u32 temp;
	u32 lidx_215_190;
	u32 dv[CI_MAX][IV_MAX];
	s16 gamma_215_190[CI_MAX][IV_MAX];
	u16 offset;
	u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX]) = {
		calc_v1_reg,
		calc_v15_reg,
		calc_v35_reg,
		calc_v59_reg,
		calc_v87_reg,
		calc_v171_reg,
		calc_v255_reg,
	};

	/*printk("%s was call gv : %d\n", __func__, gv);*/
	memset(gamma_215_190, 0, sizeof(gamma_215_190));

	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][IV_1] = smart->ve[AD_IV1].v[c];


	for (i = IV_15; i < IV_MAX; i++) {
		if (i < IV_171) {
			temp = (smart->gamma_table[G_215][dv_value[i]] * gv)/1000;
			/*printk("temp : %d, g215 val : %d, gv : %d\n",temp,smart->g215_tbl[dv_value[i]], gv);*/
			lidx_215_190 = lookup_vtbl_idx(smart, temp)+1;
			printk("look index : %d\n", lidx_215_190);
		} else {
			temp = (smart->gamma_table[G_215][dv_value[i]] * gv)/1000;
			/*printk("temp : %d, g215 val : %d, gv : %d\n",temp,smart->g215_tbl[dv_value[i]], gv);*/
			lidx_215_190 = lookup_vtbl_idx(smart, temp);
			/*printk("look index : %d\n", lidx_215_190);*/
		}
		for (c = CI_RED; c < CI_MAX; c++)
			dv[c][i] = smart->ve[lidx_215_190].v[c];
	}


	/* for IV1 does not calculate value */
	/* just use default gamma value (IV1) */
	for (c = CI_RED; c < CI_MAX; c++)
		gamma_215_190[c][IV_1] = smart->default_gamma[c];

	for (i = IV_15; i < IV_MAX; i++) {
		for (c = CI_RED; c < CI_MAX; c++)
			gamma_215_190[c][i] = (s16)calc_reg[i](c, dv) - smart->mtp[c][i];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		offset = IV_255*CI_MAX+c*2;
		result[offset+1] = gamma_215_190[c][IV_255];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		for (i = IV_1; i < IV_255; i++)
			result[(CI_MAX*i)+c] = gamma_215_190[c][i];
	}

#if 0
	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %04dV", color_name[c], dv[c][i]);
		printk("\n");
	}

	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
	for (i = IV_1; i < IV_MAX; i++) {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
				printk("2.15Gamma %c : %3d, 0x%2x", color_name[c], gamma_215_190[c][i], gamma_215_190[c][i]);
		printk("\n");
	}
#endif
	return 0;
}
u32 calc_gamma_table(struct str_smart_dim *smart, u32 gv, u8 result[])
{
    u32 i,c;
    u32 temp;
    u32 lidx;
    u32 dv[CI_MAX][IV_MAX];
    s16 gamma[CI_MAX][IV_MAX] = {0, };
    u16 offset;
    const u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX]) = 
    {
        calc_v1_reg,
        calc_v15_reg,
        calc_v35_reg,
        calc_v59_reg,
        calc_v87_reg,
        calc_v171_reg,
        calc_v255_reg,
    };

	memset(gamma, 0, sizeof(gamma));
    for(c=CI_RED;c<CI_MAX;c++){
            dv[c][0] = smart->adjust_volt[c][AD_IV1];
    }
    
    
    for(i=IV_15;i<IV_MAX;i++){
        temp = smart->g22_tbl[dv_value[i]] * gv;
        lidx = lookup_vtbl_idx(smart, temp);
        for(c=CI_RED;c<CI_MAX;c++){
            dv[c][i] = smart->ve[lidx].v[c];
        }
    }

    // for IV1 does not calculate value
    // just use default gamma value (IV1)
    for(c=CI_RED;c<CI_MAX;c++){
        gamma[c][IV_1] = smart->default_gamma[IV_TABLE_MAX * c + IV_MAX -IV_1];
    }
        
    for(i=IV_15;i<IV_MAX;i++){
        for(c=CI_RED;c<CI_MAX;c++){
            gamma[c][i] = (s16)calc_reg[i](c,dv) - smart->mtp[c][i];
    }
    }

    for(c=CI_RED;c<CI_MAX;c++){
        offset = (IV_TABLE_MAX * c);
        result[offset] = (gamma[c][IV_255] & 0xff00) >> 8;
        result[offset+1] = gamma[c][IV_255] & 0xff;
    }

    for(c=CI_RED;c<CI_MAX;c++){
        for(i=IV_1;i<IV_255;i++){
            result[(IV_MAX-i)+(IV_TABLE_MAX * c)] = gamma[c][i];
        }
    }
#if 0

    printk("++++++++++++++++++++++++++++++ MTP VALUE ++++++++++++++++++++++++++++++\n");
    for(i=IV_1;i < IV_MAX;i++){
        printk("V Level : %d - ",i);
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : 0x%08x(%04d)",color_name[c],smart->mtp[c][i],smart->mtp[c][i]);
        }
        printk("\n");
    }

	printk("++++++++++++++++++++++++++++++ MTP READ VALUE ++++++++++++++++++++++++++++++\n");
	for(i=0; i<7; i++)
		{
		extern unsigned char lcd_mtp_data[];
		printk( "[R]: %02x    [G]: %02x    [B] : %02x \n",lcd_mtp_data[i], lcd_mtp_data[i+7], lcd_mtp_data[i+14]);
		}
	printk("\n");

    printk("\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
    for(i=IV_1;i<IV_MAX;i++){
        printk("V Level : %d - ",i);
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : %04dV",color_name[c],
                dv[c][i]);
        }
        printk("\n");
    }

    
    printk("\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
    for(i=IV_1;i<IV_MAX;i++){
        printk("V Level : %d - ",i);
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : %3d, 0x%2x",color_name[c],
                gamma[c][i],gamma[c][i]);
        }
        printk("\n");
    }

 printk("\n\n++++++++++++++++++++++++++++++ ADJUST VOLTAGE ++++++++++++++++++++++++++++++\n");
 for(i=AD_IV0;i<AD_IVMAX;i++){
	 printk("V Level : %d - ",i);
	 for(c=CI_RED;c<CI_MAX;c++){
		 printk("  %c : %04dV",color_name[c],
			 smart->adjust_volt[c][i]);
	 }
	 printk("\n");
 }

     printk("\n\n++++++++++++++++++++++++++++++++++++++  VOLTAGE TABLE ++++++++++++++++++++++++++++++++++++++\n");
    for(i=0;i<256;i++){
        printk("Gray Level : %03d - ",i);
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : %04d mV",color_name[c],
                smart->ve[i].v[c]);   
        }
        printk("\n");
    }
#endif
     return 0;    
}
Пример #5
0
u32 calc_gamma_table(struct str_smart_dim *smart, u32 gv, u8 result[], u8 gamma_curve, const u8 *mtp)
{
	u32 i, c, t1;
	u32 temp;
	u32 lidx;
	u32 dv[CI_MAX][IV_MAX];
	s16 gamma[CI_MAX][IV_MAX];
	u16 offset;
	u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX], u32 adjust_volt[CI_MAX][AD_IVMAX]) = {
		calc_vt_reg,
		calc_v3_reg,
		calc_v11_reg,
		calc_v23_reg,
		calc_v35_reg,
		calc_v51_reg,
		calc_v87_reg,
		calc_v151_reg,
		calc_v203_reg,
		calc_v255_reg,
	};

memset(gamma, 0, sizeof(gamma));

#if 0
	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][IV_VT] = smart->ve[AD_IVT].v[c]; /* not use V1 calculate value*/
#endif

for (i = IV_3 ; i < IV_MAX; i++) {
	temp = (smart->gamma_table[gamma_curve][dv_value[i]] * gv) / 1000;
	lidx = lookup_vtbl_idx(smart, temp);
	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][i] = smart->ve[lidx].v[c];
}

	for (c = CI_RED; c < CI_MAX; c++) {
		offset = c*2;
		if (mtp[offset] & 0x01)
			t1 = mtp[offset + 1] * -1;
		else
			t1 = mtp[offset + 1];

		smart->mtp[c][IV_255] = t1;
	}

	for (i = 1; i < 10; i++) {
		for (c = CI_RED; c < CI_MAX; c++) {
			if (mtp[CI_MAX*(i + 1)+c] & 0x80)
				t1 = (mtp[CI_MAX*(i + 1)+c] & 0x7f) * (-1);
			else
				t1 = (mtp[CI_MAX*(i + 1)+c] & 0x7f);

			smart->mtp[c][IV_255 - i] = t1;
		}
	}

	/* for IV_1 does not calculate value */
	/* Do not use  gamma value (IV_1) */
#if 0
	for (c = CI_RED; c < CI_MAX; c++)
		gamma[c][IV_VT] = smart->default_gamma[c];
#endif

	for (i = IV_3; i < IV_MAX; i++) {
		for (c = CI_RED; c < CI_MAX; c++)
			gamma[c][i] = (s16)calc_reg[i](c, dv, smart->adjust_volt) - smart->mtp[c][i];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		offset = IV_255*CI_MAX+c*2;
		result[offset+1] = gamma[c][IV_255] & 0xff;
		result[offset] = (u8)((gamma[c][IV_255] >> 8) & 0xff);
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		for (i = IV_VT; i < IV_255; i++)
			result[(CI_MAX*i)+c] = gamma[c][i];
	}

#if 0
	printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
	for (i = IV_3; i < IV_MAX; i++)  {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %04dV", color_name[c], dv[c][i]);
		printk("\n");
	}

printk(KERN_INFO "\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
	for (i = IV_3; i < IV_MAX; i++)  {
		printk("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			printk("%c : %3d, 0x%2x", color_name[c], gamma[c][i], gamma[c][i]);
		printk("\n");
	}
#endif
return 0;
}
Пример #6
0
u32 calc_gamma_table(struct str_smart_dim *smart, u32 gv, u8 result[])
{
	u32 i, c;
	u32 temp;
	u32 lidx;
	u32 dv[CI_MAX][IV_MAX];
	s16 gamma[CI_MAX][IV_MAX];
	u16 offset;
	u32(*calc_reg[IV_MAX])(int c, u32 dv[CI_MAX][IV_MAX]) = {
		calc_v1_reg,//no call
		calc_v15_reg,
		calc_v35_reg,
		calc_v50_reg,
		calc_v87_reg,
		calc_v171_reg,
		calc_v255_reg,
	};

	memset(gamma, 0, sizeof(gamma));

	for (c = CI_RED; c < CI_MAX; c++)
		dv[c][0] = smart->adjust_volt[c][AD_IV1];

	/*found lookup voltage  dv[]*/
	for (i = IV_15; i < IV_MAX; i++) {
		temp = smart->g22_tbl[i] * gv;
		lidx = lookup_vtbl_idx(smart, temp);
		for (c = CI_RED; c < CI_MAX; c++)
			dv[c][i] = smart->ve[lidx].v[c];
	}

	/* for IV1 does not calculate value just use default gamma value (IV1) */
	for (c = CI_RED; c < CI_MAX; c++)
		gamma[c][IV_1] = smart->default_gamma[c];

	/*calculate gamma*/
	for (i = IV_15; i < IV_MAX; i++) {
		for (c = CI_RED; c < CI_MAX; c++)
			gamma[c][i] = (s16)calc_reg[i](c, dv) - smart->mtp[c][i];
	}

	/*get gamma result*/
	for (c = CI_RED; c < CI_MAX; c++) {
		offset = IV_255*CI_MAX+c*2;
		result[offset+1] = gamma[c][IV_255];
	}

	for (c = CI_RED; c < CI_MAX; c++) {
		for (i = IV_1; i < IV_255; i++)
			result[(CI_MAX*i)+c] = gamma[c][i];
	}

	LCM_SMART_DIMMY(KERN_INFO "\n*********** FOUND VOLTAGE ***** (%d) *************\n", gv+1);
	for (i = IV_1; i < IV_MAX; i++) {
		LCM_SMART_DIMMY("V Level : %d - ", i);
		for (c = CI_RED; c < CI_MAX; c++)
			LCM_SMART_DIMMY("%c : %04dV  ", color_name[c], dv[c][i]);
		LCM_SMART_DIMMY("\n");
	}

	return 0;
}
u32 calc_gamma_table(struct str_smart_dim *smart, u32 gv, u8 result[])
{
    u32 i,c;
    u32 temp;
    u32 lidx;
    u32 dv[CI_MAX][IV_MAX];
    u16 gamma[CI_MAX][IV_MAX] = {{0, },};
    u16 offset;
    const u32(*calc_reg[IV_MAX])(int ci, u32 dv[CI_MAX][IV_MAX]) = 
    {
        calc_v1_reg,
        calc_v15_reg,
        calc_v35_reg,
        calc_v50_reg,
        calc_v87_reg,
        calc_v171_reg,
        calc_v255_reg,
    };

    for(c=CI_RED;c<CI_MAX;c++){
            dv[c][0] = smart->adjust_volt[c][AD_IV1];
    }
    
    
    for(i=IV_15;i<IV_MAX;i++){
        temp = smart->g22_tbl[dv_value[i]] * gv;
        lidx = lookup_vtbl_idx(smart, temp);
        for(c=CI_RED;c<CI_MAX;c++){
            dv[c][i] = smart->ve[lidx].v[c];
        }
    }

    // for IV1 does not calculate value just use default gamma value (IV1)
    for(c=CI_RED;c<CI_MAX;c++){
        gamma[c][IV_1] = (u16)smart->default_gamma[c];
    }
        
    for(i=IV_15;i<IV_MAX;i++){
        for(c=CI_RED;c<CI_MAX;c++){
            gamma[c][i] = (u16)(calc_reg[i](c,dv) - smart->mtp[c][i]);
        }
    }

    for(c=CI_RED;c<CI_MAX;c++){
        offset = IV_255*CI_MAX+c*2;
#if 0        
        printk("offset : %d, gamma : %x\n",offset, gamma[c][IV_255]);
        printk("offset 1 : %x, offset 2 : %x\n",
            (gamma[c][IV_255] >> 8) & 0xff, gamma[c][IV_255] & 0xff);
#endif        
        result[offset] = (u8)((gamma[c][IV_255] >> 8) & 0xff);
        result[offset+1] = (u8)(gamma[c][IV_255] & 0xff);    
    }

    for(c=CI_RED;c<CI_MAX;c++){
        for(i=IV_1;i<IV_255;i++){
            result[(CI_MAX*i)+c] = (u8)gamma[c][i];
        }
    }
 
#if 0 

    printk("\n\n++++++++++++++++++++++++++++++ FOUND VOLTAGE ++++++++++++++++++++++++++++++\n");
    for(i=IV_1;i<IV_MAX;i++){
        #ifndef CONFIG_USA_MODEL_SGH_T989
        printk("V Level : %d - ",i);
        #endif
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : %04dV",color_name[c],
                dv[c][i]);
        }
        printk("\n");
    }
#endif

#if 0
    
    printk("\n\n++++++++++++++++++++++++++++++ FOUND REG ++++++++++++++++++++++++++++++\n");
    for(i=IV_1;i<IV_MAX;i++){
        #ifndef CONFIG_USA_MODEL_SGH_T989
        printk("V Level : %d - ",i);
        #endif
        for(c=CI_RED;c<CI_MAX;c++){
            printk("  %c : %3d, 0x%2x",color_name[c],
                gamma[c][i],gamma[c][i]);
        }
        printk("\n");
    }


#endif     
    return 0;    
}