123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- /*
- * =================================================================
- *
- * Filename: smart_mtp_s6e3.h
- *
- * Description: Smart dimming algorithm implementation
- *
- * Company: Samsung Electronics
- *
- * ================================================================
- */
- /*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 2012, Samsung Electronics. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- */
- #ifndef _SMART_MTP_S6E3_H_
- #define _SMART_MTP_S6E3_H_
- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/errno.h>
- #include <linux/mutex.h>
- #include <linux/wait.h>
- #include <linux/ctype.h>
- #include <asm/div64.h>
- /*
- * From 4.8 inch model use AID function
- * CASE#1 is used for now.
- */
- #define AID_OPERATION
- enum {
- GAMMA_CURVE_1P9 = 0,
- GAMMA_CURVE_2P15,
- GAMMA_CURVE_2P2,
- };
- #define MTP_START_ADDR 0xC8
- #define LUMINANCE_MAX 65
- #define GAMMA_SET_MAX 33
- #define BIT_SHIFT 22
- /*
- it means BIT_SHIFT is 22. pow(2,BIT_SHIFT) is 4194304.
- BIT_SHIFT is used for right bit shfit
- */
- #define BIT_SHFIT_MUL 4194304
- #define S6E3_GRAY_SCALE_MAX 256
- /*6.3*4194304 */
- #define S6E3_VREG0_REF_6P3 26424115
- /*6.2*4194304 */
- #define S6E3_VREG0_REF_6P2 26004685
- /*V0,V3,V11,V23,V35,V51,V87,V151,V203,V255*/
- #define S6E3_MAX 11
- /* PANEL DEPENDENT THINGS */
- #define MAX_CANDELA 350
- #define MIN_CANDELA 2
- /*
- * ID 0x20
- */
- #define V255_300CD_R_MSB_20 0x01
- #define V255_300CD_R_LSB_20 0x00
- #define V255_300CD_G_MSB_20 0x01
- #define V255_300CD_G_LSB_20 0x00
- #define V255_300CD_B_MSB_20 0x01
- #define V255_300CD_B_LSB_20 0x00
- #define V203_300CD_R_20 0x80
- #define V203_300CD_G_20 0x80
- #define V203_300CD_B_20 0x80
- #define V151_300CD_R_20 0x80
- #define V151_300CD_G_20 0x80
- #define V151_300CD_B_20 0x80
- #define V87_300CD_R_20 0x80
- #define V87_300CD_G_20 0x80
- #define V87_300CD_B_20 0x80
- #define V51_300CD_R_20 0x80
- #define V51_300CD_G_20 0x80
- #define V51_300CD_B_20 0x80
- #define V35_300CD_R_20 0x80
- #define V35_300CD_G_20 0x80
- #define V35_300CD_B_20 0x80
- #define V23_300CD_R_20 0x80
- #define V23_300CD_G_20 0x80
- #define V23_300CD_B_20 0x80
- #define V11_300CD_R_20 0x80
- #define V11_300CD_G_20 0x80
- #define V11_300CD_B_20 0x80
- #define V3_300CD_R_20 0x80
- #define V3_300CD_G_20 0x80
- #define V3_300CD_B_20 0x80
- #define VT_300CD_R_20 0x00
- #define VT_300CD_G_20 0x00
- #define VT_300CD_B_20 0x00
- /* PANEL DEPENDENT THINGS END*/
- enum {
- V1_INDEX = 0,
- V3_INDEX = 1,
- V11_INDEX = 2,
- V23_INDEX = 3,
- V35_INDEX = 4,
- V51_INDEX = 5,
- V87_INDEX = 6,
- V151_INDEX = 7,
- V203_INDEX = 8,
- V255_INDEX = 9,
- };
- struct GAMMA_LEVEL {
- int level_0;
- int level_1;
- int level_3;
- int level_11;
- int level_23;
- int level_35;
- int level_51;
- int level_87;
- int level_151;
- int level_203;
- int level_255;
- } __packed;
- struct RGB_OUTPUT_VOLTARE {
- struct GAMMA_LEVEL R_VOLTAGE;
- struct GAMMA_LEVEL G_VOLTAGE;
- struct GAMMA_LEVEL B_VOLTAGE;
- } __packed;
- struct GRAY_VOLTAGE {
- /*
- This voltage value use 14bit right shit
- it means voltage is divied by 16384.
- */
- int R_Gray;
- int G_Gray;
- int B_Gray;
- } __packed;
- struct GRAY_SCALE {
- struct GRAY_VOLTAGE TABLE[S6E3_GRAY_SCALE_MAX];
- struct GRAY_VOLTAGE VT_TABLE;
- } __packed;
- /*V0,V1,V3,V11,V23,V35,V51,V87,V151,V203,V255*/
- struct MTP_SET {
- char OFFSET_255_MSB;
- char OFFSET_255_LSB;
- char OFFSET_203;
- char OFFSET_151;
- char OFFSET_87;
- char OFFSET_51;
- char OFFSET_35;
- char OFFSET_23;
- char OFFSET_11;
- char OFFSET_3;
- char OFFSET_1;
- } __packed;
- #ifdef CONFIG_HBM_PSRE
- struct MTP_OFFSET_400CD {
- struct MTP_SET R_OFFSET;
- struct MTP_SET G_OFFSET;
- struct MTP_SET B_OFFSET;
- char mtp_400cd[6]; /*gamma for 400cd*/
- char elvss_400cd; /*elvss for 400cd*/
- } __packed;
- #endif
- struct MTP_OFFSET {
- struct MTP_SET R_OFFSET;
- struct MTP_SET G_OFFSET;
- struct MTP_SET B_OFFSET;
- } __packed;
- struct illuminance_table {
- int lux;
- char gamma_setting[GAMMA_SET_MAX];
- } __packed;
- struct SMART_DIM {
- #ifdef CONFIG_HBM_PSRE
- struct MTP_OFFSET_400CD MTP_ORIGN;
- #else
- struct MTP_OFFSET MTP_ORIGN;
- #endif
- struct MTP_OFFSET MTP;
- struct RGB_OUTPUT_VOLTARE RGB_OUTPUT;
- struct GRAY_SCALE GRAY;
- /* Because of AID funtion, below members are added*/
- int lux_table_max;
- int *plux_table;
- struct illuminance_table gen_table[LUMINANCE_MAX];
- int brightness_level;
- int ldi_revision;
- int vregout_voltage;
- } __packed;
- #endif
|