tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / video / sprdfb / mdnie / mdnie_lite.h
1 /*
2  * Copyright (C) 2015 Samsung Electronics Co.Ltd
3  *
4  * This program is free software; you can redistribute  it and/or modify it
5  * under  the terms of  the GNU General  Public License as published by the
6  * Free Software Foundation;  either version 2 of the  License, or (at your
7  * option) any later version.
8  *
9  */
10 #ifndef _MDNIE_LITE_H_
11 #define _MDNIE_LITE_H_
12
13 typedef u8 mdnie_t;
14
15 #define MAX_DATA        150
16
17 enum mdnie_mode {
18         MODE_DYNAMIC,
19         MODE_STANDARD,
20         MODE_NATURAL,
21         MODE_MOVIE,
22         MODE_AUTO,
23         MODE_MAX,
24 };
25
26 enum mdnie_accessibility {
27         ACCESSIBILITY_OFF,
28         NEGATIVE,
29         COLOR_BLIND,
30         SCREEN_CURTAIN,
31         GRAYSCALE,
32         GRAYSCALE_NEGATIVE,
33         ACCESSIBILITY_MAX
34 };
35
36 enum mdnie_scenario {
37         SCENARIO_UI,
38         SCENARIO_GALLERY,
39         SCENARIO_VIDEO,
40         SCENARIO_VTCALL,
41         SCENARIO_CAMERA = 4,
42         SCENARIO_BROWSER,
43         SCENARIO_NEGATIVE,
44         SCENARIO_EMAIL,
45         SCENARIO_EBOOK,
46         SCEANRIO_GRAY,
47         SCENARIO_MAX,
48 };
49
50 enum mdnie_outdoor {
51         OUTDOOR_OFF = 0,
52         OUTDOOR_ON,
53         OUTDOOR_MAX,
54 };
55
56 enum MDNIE_CMD {
57         LEVEL1_KEY_UNLOCK,
58         MDNIE_CMD1,
59         LEVEL1_KEY_LOCK,
60         MDNIE_CMD_MAX,
61 };
62
63 typedef struct lcm_init_code_tag {
64         unsigned int tag;
65         unsigned char data[MAX_DATA];
66 } lcm_init_code;
67
68 struct mdnie_command {
69         lcm_init_code *sequence;
70         unsigned int size;
71         unsigned int sleep;
72 };
73
74 struct mdnie_table {
75         char *name;
76         struct mdnie_command tune[MDNIE_CMD_MAX];
77 };
78
79 #define MDNIE_SET(id)   \
80 {                                       \
81         .name   = #id,                  \
82         .tune   = {                     \
83                 {.sequence = LEVEL1_UNLOCK, .size = ARRAY_SIZE(LEVEL1_UNLOCK), .sleep = 0,}, \
84                 {.sequence = id##_1, .size = ARRAY_SIZE(id##_1), .sleep = 0,}, \
85                 {.sequence = LEVEL1_LOCK, .size = ARRAY_SIZE(LEVEL1_LOCK), .sleep = 0,}, \
86         }       \
87 }
88
89 struct mdnie_ops {
90         int (*write)(void *data, struct mdnie_command *seq, u32 len);
91         int (*read)(void *data, u8 addr, mdnie_t *buf, u32 len);
92         int (*color)(void *data, u32 *co_ord);
93 };
94
95 typedef int (*mdnie_w)(void *devdata, struct mdnie_command *seq, u32 len);
96 typedef int (*mdnie_r)(void *devdata, u8 addr, u8 *buf, u32 len);
97 typedef int (*mdnie_c)(void *devdata, u32 *co_ord);
98
99 struct mdnie_lite_device {
100         enum mdnie_mode                 mode;
101         enum mdnie_scenario             scenario;
102         enum mdnie_outdoor              outdoor;
103         enum mdnie_accessibility        accessibility;
104         struct device           *dev;
105         bool                    tuning;
106         unsigned int            enable;
107         struct mdnie_ops        ops;
108         struct notifier_block   fb_notif;
109         struct mutex            dev_lock;
110         struct mutex            lock;
111         char                    path[50];
112         unsigned int co_ordinates[2];
113         unsigned int color_correction
114 };
115
116 #endif /*_MDNIE_LITE_H_*/